Tuesday, March 6, 2012

[MSSQL + VS.NET] Connection - sleeping

Hello
I've prepared a small aplication in VS.NET and I use SqlConnection class.
Everything is ok, but when I'm trying to disconnect from server using
if (cnSQL->State != ConnectionState::Closed) cnSQL->Close()
there is still connection do server present. I have to close connection
because I'm trying to drop this database.
Have you ever heard about this kind of problem??

Trociu

--
Plain-text over all!!!
/**********/
write me : trociu@.autonom ict pwr wroc pl
search me : gg: 1382729"Trociu" <trociu@.autonom.ict.pwr.wroc.pl> wrote in message
news:slrncmhvuv.14n.trociu@.autonom.ict.pwr.wroc.pl ...
> Hello
> I've prepared a small aplication in VS.NET and I use SqlConnection class.
> Everything is ok, but when I'm trying to disconnect from server using
> if (cnSQL->State != ConnectionState::Closed) cnSQL->Close()
> there is still connection do server present. I have to close connection
> because I'm trying to drop this database.
> Have you ever heard about this kind of problem??
> Trociu
> --
> Plain-text over all!!!
> /**********/
> write me : trociu@.autonom ict pwr wroc pl
> search me : gg: 1382729

I have no idea, unless perhaps you're using connection pooling, and the pool
is still active? You might get a better response in a VB or .NET group.

From the server side, you can use ALTER DATABASE to disconnect all users
from a database - see Books Online:

ALTER DATABASE MyDB SET OFFLINE WITH ROLLBACK IMMEDIATE

Simon

No comments:

Post a Comment