I have run into a scenario that I have not seen posted here. If I missed something, please let me know. It appears that the code for the ExecuteNonQuery (and ExecuteDataSet for that matter) does not close the connection if you call it using a connection string
instead of a Connection object. If I understand the code correctly, the following method (I apologize for the word wrap): ExecuteNonQuery( string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters) creates
a connection using the connectionString parameter, then calls: ExecuteNonQuery(connection, commandType, commandText, commandParameters); However, it never closes the connection. Is that correct? Did I miss something? If not, is this a bug or is it working
as designed? Do you have to depend on garbage collection if you use SqlHelper with connection strings instead of connections? I have seen the threads regarding the connection leaking using DataReaders (fixed in the sample code for DAAB 2.0, but I have not
seen a reference to this issue. Thanks in advance for your assistance. -Weston
Weston Binfo...
Member
190 Points
38 Posts
Microsoft Data Access Application Block not closing connections?
Sep 16, 2003 08:50 PM|LINK
Trason Consulting, Inc.
wbnospam@yahoo.com
(yes, it is a real e-mail address)