Interviews1 answer
When connection to database is failed, Which exception will be thrown?
Andrew
Posted Aug 17, 2011, 7:58 PM EDT1 Answer
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.
Jon GuentherPosted Aug 23, 2011, 5:35 PM EDT
