Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design Question
Message
From
23/03/2009 18:27:46
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Miscellaneous
Thread ID:
01389713
Message ID:
01390881
Views:
58
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform