Re: Why can't open the second DataReader ? by Nicole
Nicole
Sun Oct 26 13:48:54 CST 2003
David,
I didn't suggest the join because of the potentially large volume of
redundant data that could be involved. The dataset is supposed to help us
avoid this sort of thing and, except in some very "particular"
circumstances, there's little reason to even consider the join alternative.
Of course, it would still be much better than the looping db round-trip...
<g>
Nicole
"David" <dfoster@127.0.0.1> wrote in message
news:slrnbpo8po.lg7.dfoster@woofix.local.dom...
> In article <OTkEfw9mDHA.1004@TK2MSFTNGP09.phx.gbl>, Nicole Calinoiu wrote:
> > A datareader uses a fire-hose cursor, which blocks the connection.
While dr
> > is still open against sqlConnection1, you cannot use sqlConnection1 for
> > anything else, including the execution of cmd2. You basically have
three
> > options:
> <snip>
>
> or
> 4. Use a single DataReader
> cmd.CommandText = "SELECT table1.*, table2.* FROM table1 LEFT JOIN
> table2 on table1.my_id = table2.my_id ORDER BY table1.my_id";
>
> // or possibly INNER JOIN depending on your needs
>
> And then check for a change in my_id when you loop through the records.
>
> I agree with Nicole, though, a DataSet is probably your best bet here.
> In any case, requiring a new round trip to the database on every
> iteration of the loop is probably A Bad Thing here.
>
> --
> David
> dfoster at
> hotpop dot com