Connection state with DataAdapter.Fill()
-
:omg:hi, I confused with sql database connection state for SqlDataAdapter.Fill() method. SqlDataAdapter retrieve the data from database with closed connection with server exception "Invalid operation ..." but it won’t throw that exception. How it works?.. Plz clear my doubt.
friendly, ranandbe
-
:omg:hi, I confused with sql database connection state for SqlDataAdapter.Fill() method. SqlDataAdapter retrieve the data from database with closed connection with server exception "Invalid operation ..." but it won’t throw that exception. How it works?.. Plz clear my doubt.
friendly, ranandbe
ranandbe wrote:
I confused with sql database connection state for SqlDataAdapter.Fill() method
There's no need of any explicit open and close of the Database Connection when you use SQLDataAdapter.
SQLDataAdapter
will handle that for you. The DataAdapter willimplicitly
open the connection when it has to retrieve the Data and Close the connection Once it is done.- Regards -
JON
Life is not measured by the amount of breaths we take, but by the moments that take our breath away.
-
:omg:hi, I confused with sql database connection state for SqlDataAdapter.Fill() method. SqlDataAdapter retrieve the data from database with closed connection with server exception "Invalid operation ..." but it won’t throw that exception. How it works?.. Plz clear my doubt.
friendly, ranandbe
-
:omg:hi, I confused with sql database connection state for SqlDataAdapter.Fill() method. SqlDataAdapter retrieve the data from database with closed connection with server exception "Invalid operation ..." but it won’t throw that exception. How it works?.. Plz clear my doubt.
friendly, ranandbe
-
Fill() method automatically open the connection and again disconnect after execution in case connection was not oper prior to execution of Fill() method, In case connection was open you will have close it manually.