Data access app block connections

  • Thread starter Thread starter Yehuda Tuvia
  • Start date Start date
Y

Yehuda Tuvia

Hi all,
Glad to join you all...
Does the Data Access Application Block closes the connections associated to
him automaticly, After executing a command. Or do I have to close the
connections manualy?

Jud
 
Hi Yehuda,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know if the connection will
be closed after executing a command in Data Access Application Block. If
there is any misunderstanding, please feel free to let me know.

Since source code is included in the application block, we can check it to
see if the connections are closed. Generally, when you use ExecuteReader
and ExecuteXmlReader, the connection is left open. Because if we need an
open connection to manipulate the returned data. For other methods, if you
pass in a connection string, the connection will be closed immediately
after they are used. If you pass a SqlConnection object, the connection
state will be left as it was before executed.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
The data access application block will close a connection if you just passed
it a connection string. In this instance, it will have to open a connection
and since it opened a connection internally in the component you do not have
a connection reference that you can close.

If you create a valid connection and pass it to it, you can always check the
connection state and if the connection state is open you can close it
explicitly.
 
Back
Top