SqlException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code to open a database. Since I don't have the db as
specified in the connectionString, the connection.Open() will throw an
SqlException. My question is why it opens the "SqlException occured" dialog
before it goes to the catch block? Is there a setting to turn the dialog off?
I am expecting to catch and handle the exception myself. I am in debug mode.

try
{
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
}
catch (Exception e)
{
}
 
This is the debugger doing this. Run your executable without debugging or
just outside of the IDE completely, it will behave as expected.
 
Back
Top