M
Michael Russell
Hi All,
Trying to get a grip on the proper deallocation of unmanaged resources.
I asked some general questions in another group, here's my ADO
question: If I call Dispose on a DbDataAdapter, for example, am I
correct in understanding that it will dispose of the DbConnection that
it uses? This statement in the .Net 2.0 documentation for
DbDataAdapter.Dispose() seems to imply that it does: "Releases all
resources used by the Component".
It would appear that I'm going to run into problems in this scenario: I
have a single DbConnection as an instance variable in a class. Within
that class, I have a method that creates, and then disposes of, a
DbDataAdapter that uses this connection. The second time I call that
method, it will fail because the disposal of the adapter also disposed
of the connection (as opposed to just closing it).
Or am I totally misinterpreting the documentation?
Trying to get a grip on the proper deallocation of unmanaged resources.
I asked some general questions in another group, here's my ADO
question: If I call Dispose on a DbDataAdapter, for example, am I
correct in understanding that it will dispose of the DbConnection that
it uses? This statement in the .Net 2.0 documentation for
DbDataAdapter.Dispose() seems to imply that it does: "Releases all
resources used by the Component".
It would appear that I'm going to run into problems in this scenario: I
have a single DbConnection as an instance variable in a class. Within
that class, I have a method that creates, and then disposes of, a
DbDataAdapter that uses this connection. The second time I call that
method, it will fail because the disposal of the adapter also disposed
of the connection (as opposed to just closing it).
Or am I totally misinterpreting the documentation?