Groups | Blog | Home
all groups > c# > april 2008 >

c# : Usually should we call IDbCommand.Dispose() after done with a IDbCommand?


Arne_Vajhøj
4/6/2008 9:58:22 AM
[quoted text, click to view]

If something implements IDisposable then we should call Dispose
when done.

I am 99.99% sure that you will not leak unmanaged ressources
if you just remember to Close/Dispose the connections (databases
tend to do things per connection).

And I must admit that I don't make that call myself.

But if you are asking for what is most correct, then do
as I say not as I do.

:-)

Cor Ligthert[MVP]
4/6/2008 5:32:02 PM
Ryan,

As your programs go to fast, than you can add all kind of code, including
this one, why not.
(This one has not any impact on the database)

Cor

"Ryan Liu" <rliu@powercati.com> schreef in bericht
news:Oyi0Cy%23lIHA.4744@TK2MSFTNGP06.phx.gbl...
[quoted text, click to view]
Ryan Liu
4/6/2008 9:45:35 PM
Hi,

Usually should we call IDbCommand.Dispose() after done with a IDbCommand?

If not, what impact to the database server?

Thanks,
Ryan

AddThis Social Bookmark Button