Hi,
The prevailing wisdom for coding try/catch statements around db connections seems to be as follows:
conn = new MySqlConnection();
cmdGetDate = new MySqlCommand();
try
{
conn.ConnectionString = connStringSQL;
conn.Open();
...do some stuff
}
catch (Exception dbErr)
{
throw new Exception(dbErr.Message);
}
finally
{
conn.Close();
cmdGetDate.Dispose();
conn.Dispose();
}
My question is, what if an exception occurs on closing the connection (which is inside the finally part of the try/catch)?