DataAdapter.Dispose

S

Simon Harris

Hi All,

You may have seen my post earlier in the week about using conn.close and
conn.dispose (Thanks Karl for your answers!)

I've read in my MS study guide that DataAdapters open and close database
connections automatically.

So, can I just call DataAdapterInstance.Dispose ?

Previously I have called conn.close (conn.dispose from now on!) but is
there
any need for me to explicily close the connection?

Maybe I'm splitting hairs here...70-305 exam this afternoon! would be good
to know.

Cheers!
Simon.
 
S

Scott Allen

Dispose is freeing the connection, there is no need to call both
Dispose and Close. If are are using the Fill method on the data
adapter, then the adapter will open the connection if it isn't open,
and if the adapter opens the connection it will also properly clean it
up before the Fill method returns.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top