I am doing a pretty vanilla connection to a SQL Server. (The code follows)
String strSQL = "";
//get the connection
try
{
strSQL = "data source=" + txtServer + ";initial catalog=" + strDatabase + ";persist security info=False;user id=sa;packet size=4096";
cn = new SqlConnection(strSQL);
//open the connection to make sure all is well
cn.Open();
//just close it now, let the app deal with opening it when needed
cn.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
throw(new Exception("Unable to connect to database."
);
}
The problem is this:
When testing the error handler (disconnecting from the network and trying to log in) I get an "Out of memory" error, or if I try to put a break point on a line in the catch block, the debugger will crash after a few seconds with no error.
Gah!
Any suggestions? Has anyone else ever seen this?
String strSQL = "";
//get the connection
try
{
strSQL = "data source=" + txtServer + ";initial catalog=" + strDatabase + ";persist security info=False;user id=sa;packet size=4096";
cn = new SqlConnection(strSQL);
//open the connection to make sure all is well
cn.Open();
//just close it now, let the app deal with opening it when needed
cn.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
throw(new Exception("Unable to connect to database."
}
The problem is this:
When testing the error handler (disconnecting from the network and trying to log in) I get an "Out of memory" error, or if I try to put a break point on a line in the catch block, the debugger will crash after a few seconds with no error.
Gah!
Any suggestions? Has anyone else ever seen this?