Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design Question
Message
De
23/03/2009 18:27:46
 
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Divers
Thread ID:
01389713
Message ID:
01390881
Vues:
59
>A using clause will make a call to the Dispose method of the object declared in the using statement. In this case, that object is oConn. Thus, for oConn.Dispose() to be called, it will either implicitly call oConn.Close() and/or it will explicitly CloseHandle from KERNAL32.DLL, depending on the makeup of the object in question. Therefore, the connection is closed once the using clause goes out of scope.

Right, I realized that I missed that point (see Message #1390261).

~~Bonnie



>
>>>The SqlConnection will close when it exits the using clause.
>>
>>No, I don't think so ... I'm pretty sure that even though the oConn object goes out of scope, the connection will remain open.
>>
>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform