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.
 

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