MrTee Posted November 22, 2004 Posted November 22, 2004 I'm using Visual Studio .NET to create an ASP.NET app with database access. I've set up the database access using the Visual Studio .NET web controls that are provided (SQLConnection, SQLDataAdapter, etc.) My problem is that I'm not sure how to catch connection errors. The code that handles the database connections is generated by Visual Studio. Is there a way to catch and handle these errors? Quote
*Gurus* Derek Stone Posted November 22, 2004 *Gurus* Posted November 22, 2004 You'll need to place a try/catch block around the code that generates the exception. Try connection.Open() Catch sqlEx As SqlException Log.Write(sqlEx) Finally If Not connection Is Nothing connection.Close() connection.Dispose() End If End Try Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.