J
Jimmy
My brain must be going to sleep but can anyone tell me why after running
this code the database connection remains open?
I am testing some code and, after running these lines, when I try to drop
the database I cannot because this retains a connection. Shouldn't this
connection be dropped automatically? If not, how can I force the connection
to close?
using (SqlConnection testConnection = new SqlConnection())
{
testConnection.ConnectionString = string.Format("Data Source={0};Initial
Catalog={1};Integrated Security=SSPI;", server, database);
testConnection.Open();
}
this code the database connection remains open?
I am testing some code and, after running these lines, when I try to drop
the database I cannot because this retains a connection. Shouldn't this
connection be dropped automatically? If not, how can I force the connection
to close?
using (SqlConnection testConnection = new SqlConnection())
{
testConnection.ConnectionString = string.Format("Data Source={0};Initial
Catalog={1};Integrated Security=SSPI;", server, database);
testConnection.Open();
}