dispose method

  • Thread starter Thread starter bart
  • Start date Start date
B

bart

I have two questions about the dispose process

1) If I call dispose on a connection, I assume that all
the command objects using that connections will also be
destroyed

2) Should I call dispose on all my objects or let the GC
take care of it?

thanks in advance,
Bart
 
Hi Bart,

(1) These command objects won't be destroyed when you call connection's
dispose method

(2) It is essential to call Dispose() or Close() for the Connection object
though, since it actually holds on to a
physical network connection to the database server. By the way
Connection.Close() and Connection.Dispose() do exactly the same thing.

Hope this help

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top