Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataAdapter Connection
Message
From
14/02/2009 00:32:37
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01381605
Message ID:
01381701
Views:
38
>>If a connection is already open, does a DataAdapter close it & reopen it? Does the DA close it in all cases, or only if it opened the connection?
>
>AFAIK, if it's open, it's left open. It leaves it in the same state as it was passed in. So if it's not open when you call the DA, it will open it, fill the data, then close it. If it's already open it will use the open connection (and leave it that way when finished).


What you've stated, Paul, is true only when using the Fill() method of the DataAdapter. If you're using the ExecuteNonQuery() method of the SqlCommand (or OleDbCommand), then you have to explicitly open and/or close the connection yourself.

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform