J
John H
I have a question about the life of the connection used by SQLHelper.
When I execute the lines below it looks as if it keeps the connection
to the database.
_sConnString = "Server=.;Database=tester;Integrated Security=SSPI;"
SqlHelper.ExecuteNonQuery(_sConnString, CommandType.Text, "select 1")
When I walk through the code and execute the lines above I can check
for the
connections in Query Analyzer using sp_who2 and I see a new SPID for
this process. I thought that the method was just going to open the
connection to execute the query and then close it's connection.
The problem I have is that later in the code when I open a connection
to the master database and try to drop database tester, I get the
message that the tester database is in use. I can still see the SPID
record for the connection caused by the lines above.
Is there a way to make sure the database is not connected so that I
can drop the database properly?
John H
When I execute the lines below it looks as if it keeps the connection
to the database.
_sConnString = "Server=.;Database=tester;Integrated Security=SSPI;"
SqlHelper.ExecuteNonQuery(_sConnString, CommandType.Text, "select 1")
When I walk through the code and execute the lines above I can check
for the
connections in Query Analyzer using sp_who2 and I see a new SPID for
this process. I thought that the method was just going to open the
connection to execute the query and then close it's connection.
The problem I have is that later in the code when I open a connection
to the master database and try to drop database tester, I get the
message that the tester database is in use. I can still see the SPID
record for the connection caused by the lines above.
Is there a way to make sure the database is not connected so that I
can drop the database properly?
John H