Experience with .NET has taught me that calling .Close and .Dispose is
necessary when applications have a high number of users and operations.  I
like to call .Close because I like to do a specific .Close.  Depending on a
certain behavior is something that I have found causes more problems than
just performing the operations explicitly.  Calling .Dispose automagically
calls .Close and releases some unmanaged resources that the SqlClient uses.
By calling both .Close and .Dispose, I have resolved this specific problem
in several situations.

Setting the object to null/nothing is my old com habit carried forward.

Wally

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Heath Ryan
Sent: Friday, September 26, 2003 9:00 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] The timeout period elapsed prior to obtaini
ng a connection from t he pool.

Just to straighten some...

<WallaceB.McClure_wrote>
I always perform my close and
dispose within the finally section of a try-catch-finally block.  As a
last item, I also mark the objects for deletion by specifically setting
the objects to null/nothing.
</WallaceB.McClure_wrote>

- It is not needed to call both Dispose and Close in the same line. Dispose
is calling Close anyways...
- setting null/nothing is not needed for locally defined objects, these
objects are "marked" for collection as soon as they go of scope, since they
are not reachable anymore.
- setting null/nothing on member objects may be valid depending on the usage
of these objects...

HTH
// Ryan





-------------------------------------
The information included in this message is personal and/or confidential and
intended exclusively for the addressees as stated. This message and/or the
accompanying documents may contain confidential information and should be
handled accordingly. If you are not the intended reader of this message, we
urgently request that you notify Centric immediately and that you delete
this e-mail and any copies of it from your system and destroy any printouts
immediately.
It is forbidden to distribute, reproduce, use or disclose the information in
this e-mail to third parties without obtaining prior permission from
Centric. We expressly point out that there are risks associated with the use
of e-mail. Centric and the companies within the group shall not accept any
liability whatsoever for damage resulting from the use of e-mail. Legally
binding obligations can only arise for Centric by means of a written
instrument, signed by an authorized representative of Centric.
-------------------------------------

===================================
This list is hosted by DevelopMentorR  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to