Kirk
Fri Feb 20 14:37:54 CST 2004
I ran into the same dilema on a project I did. the solution I finally
implemented was to load the data into a datatable instead of using the
DataReader. Then loop through the DataTable to make the next set of calls.
this way the connection is not kept busy by the DataReader.
The only other option (which is MUCH worse) is to keep opening new
connections. Not something I was willing to do.
OR, there is one other option.... (also not a great one by the way) , you
could use an ADO Recordset. ADO Recordsets do not lock the connection the
way an ADO.Net datareader does.
Kirk Graves
KRGIT Software
"jimbo" <jim.hong@staubach.com> wrote in message
news:8BAE931D-B0A2-4EDA-83EC-3CF566EE1C40@microsoft.com...
> Okay, I just read you can't nest DataReaders. Okay fine, so how do you
nest stored procedure calls then?
>
> ----- jimbo wrote: -----
>
> Inside a function, i call a stored procedure with a datareader. The
function is called repeatedly (like 8 times) feeding a different parameter
into the function. Then i get the "There is already an open DataReader
associated with this Connection which must be closed first." error. I close
both the datareader and connection object at the end of the function. I
thought i found the issue on MS support but it seems like a framework 1.0
issue i'm running 1.1
>
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q319345
>
> Any ideas? I would really appreciate it if someone could shed some
light.
>