Re: Question about Dispose

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Bob Lehmann (none)
Date: 05/20/04


Date: Thu, 20 May 2004 10:39:08 -0600

OK - got it.

Thanks,
Bob Lehmann

"Mythran" <kip_potter@hotmail.com> wrote in message
news:#2SbaXoPEHA.4036@TK2MSFTNGP12.phx.gbl...
>
> "Bob Lehmann" <none> wrote in message
> news:uxIpzSoPEHA.3348@TK2MSFTNGP09.phx.gbl...
> > Thanks, Jon.
> >
> > So, is there any reason to *ever* use Close() instead?
> >
> > Bob Lehmann
>
> Yes, quoted from Ashish:
>
> "The Dispose() method releases all resources associated to the connection
> object (including removing it from the connection pool). Not a good
practise
> to call Dispose() unless you want connection to be removed from the
> connection pool."
>
>
> That about sums it up :)
>
> If you are worried about connection pooling, you will want to not use
> Try...Finally and Dispose(). You will use Try...Finally and then check to
see if
> 1.) the connection exists 2.) it's open 3.) call Close().
>
> Hope this helps :)
>
> Mythran
>
>



Relevant Pages

  • Re: Question about IDispose
    ... > connection pool is specifically setup to prevent object destruction because ... > place dependency in the overridden dispose function. ... The benefits of pooling here make or break the website. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SqlConnection.Dispose close connection?
    ... By the way - I've heard somewhere that calling Dispose() on an SqlConnection ... instance removes this connection from the connection pool, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Question about IDispose
    ... connection pool is specifically setup to prevent object destruction because ... So the *fix cannot come from the Dispose layer. ... The benefits of pooling here make or break the website. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: max pool size reached on dev workstation
    ... or dispose (by virtue of calling close)..." ... The extra work other than simply closing that dispose did above was..." ... To close a connection, pooled or unpooled, the programmer has two choices: ... > The connection pool is maintained I think on another thread. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Question about Dispose
    ... >> Bob Lehmann ... > "The Dispose() method releases all resources associated to the connection ... > object (including removing it from the connection pool). ...
    (microsoft.public.dotnet.framework.adonet)