I want to exit a procedure if an exception occurs. But this is not working. The app continues to run through the procedure. How can I make it work?
Code:
try
{
sqlConnection1.Open();
}
catch (System.Data.SqlClient.SqlException e2)
{
MessageBox.Show("Exception Thrown: " + e2 + ". Check permissions.");
//enter code to shut down app
this.Close();
Application.Exit();
}
catch (Exception e3)
{
MessageBox.Show("Exception Thrown: " + e3);
//enter code to shut down app
this.Close();
Application.Exit();
}
Thanks,
cj