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

  • Thread starter Thread starter Ryan Liu
  • Start date Start date
R

Ryan Liu

Hi,

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

If not, what impact to the database server?

Thanks,
Ryan
 
Ryan said:
Usually should we call IDbCommand.Dispose() after done with a IDbCommand?

If not, what impact to the database server?

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.

:-)

Arne
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top