Thanks,

There are many other convenient function in DataAccessBlock like
ExecuteDataset, ExecuteScalar, they all return some object or dataset..
I think they all must open a connection in their funciton.

When I call them like:
string cnnStr="...";
sCmd="Select ..";
DataSet ds=ExecuteDataset(cnnStr, CommandType.Text, sCmd);

Will it close the connection after return value?

Re: The conneciton in DataAccess block by Chris

Chris
Tue Aug 30 16:41:01 CDT 2005

Hi,

Yes, as a rule if the data access method is opening the connection it takes
ownership of the connection and ensures that the connection is closed. Only
the ExecuteReader has a slight variation on this in that you are required to
close the DataReader. Of course some of the overlaods accept an existing
connection in which case if the connection was already open the connection
will remain open after the call.

Hope this helps

--
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor


"ad" <flying@wfes.tcc.edu.tw> wrote in message
news:eCx1QlarFHA.2072@TK2MSFTNGP14.phx.gbl...
> Thanks,
>
> There are many other convenient function in DataAccessBlock like
> ExecuteDataset, ExecuteScalar, they all return some object or dataset..
> I think they all must open a connection in their funciton.
>
> When I call them like:
> string cnnStr="...";
> sCmd="Select ..";
> DataSet ds=ExecuteDataset(cnnStr, CommandType.Text, sCmd);
>
> Will it close the connection after return value?
>
>