Andrew
When connection to database is failed, Which exception will be thrown?
By Andrew in SQL Server on Aug 17 2011
  • Jon Guenther
    Aug, 2011 23

    It depends specifically on which one you use. The DataException class collects errors specific to ADO.NET components, and the SqlException class is used to capture messages specifically regarding SQL Server and ops in the System.Data.SqlClient classes. Depending on what you're specifically trying to do, you can attempt a connection in a try/catch block and throw specific information regarding the exception. See http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlexception.aspx for more information.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS