Database connectivity

  • Thread starter Thread starter Maziar Aflatoun
  • Start date Start date
M

Maziar Aflatoun

Hi everyone,

Is there a need to close any of the following when done using them? or does
C# take care of them by itself.

OleDBDataAdaptor?
OleDBConnection?
dataSet?

Thank you
Maziar A.
 
Maziar,

Since all three classes implement the IDisposable interface (they all
derive from Component, which implements the interface), when you are done
with them, you should call the Dispose method (or Close) on each of them.
This is the general rule when using classes that implement the IDisposable
interface (basically acquire late and release early).

Hope this helps.
 
Back
Top