Hi Gawel:
Yes, you'll still need to invoke Close, or Dispose on the
SqlDataReader. It's absolutely critical to do so if you are using
ExecuteReader with CommandBehavior.CloseConnection. If you want to
avoid invoking Close, perhaps using a DataSet would suit your
application better?
--
Scott
http://www.OdeToCode.com On Fri, 21 May 2004 22:31:12 +0200, "Gawel" <gawelek@SPAMIKgazeta.pl>
[quoted text, click to view] wrote:
>Thanks for answer
>>back up to when you execute your reader from the command object
>> Dim reader As SqlDataReader =
>cmd.ExecuteReader(CommandBehavior.CloseConnection)
>>This essentially closes the connection when the reader is closed.
>But I still need to call Colse() on reader ?
>And this is what I want to avoid.
>
>Gawel
>
control.DataSource = reader;
control.DataBind();
Is it possible that DataBind() will close automatically the reader ?
--
Gawel
-------------------------------
Pierwszy ³yk z pucharu nauk przyrodniczych czyni ateist±, ale na dnie
pucharu czeka Bóg.
Werner Heisenberg
[quoted text, click to view] > Yes, you'll still need to invoke Close, or Dispose on the
> SqlDataReader. It's absolutely critical to do so if you are using
> ExecuteReader with CommandBehavior.CloseConnection. If you want to
> avoid invoking Close, perhaps using a DataSet would suit your
> application better?
Yes, I think about converitng each datareader to the datatable.
It can be done without knowledge about the content of the data and
is one of possible solutions. It will be great to have
DataBind(Behevior.CloseAfterFetching)
Gawel