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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ryan Liu

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

    Hi,

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

    If not, what impact to the database server?

    Thanks,
    Ryan


  • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

    #2
    Re: Usually should we call IDbCommand.Disp ose() after done with aIDbCommand?

    Ryan Liu wrote:
    Usually should we call IDbCommand.Disp ose() 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

    Comment

    • Cor Ligthert[MVP]

      #3
      Re: Usually should we call IDbCommand.Disp ose() after done with a IDbCommand?

      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 .comschreef in bericht
      news:Oyi0Cy%23l IHA.4744@TK2MSF TNGP06.phx.gbl. ..
      Hi,
      >
      Usually should we call IDbCommand.Disp ose() after done with a IDbCommand?
      >
      If not, what impact to the database server?
      >
      Thanks,
      Ryan
      >

      Comment

      Working...