B
Bernie Hunt
OK, I promise no more questions after this one today!
My application is reading data out of an ODBC database for creating
reports. I'm using Datareaders because they are lighter weight and I only
need to read through the data once.
My problem is that as I run through the records in the data reader, I
need to open a second set of records depending on what I find in the
first record, example.
Open recordset1
Loop through recordset1
process some fields
Open recordset2
Loop through recordset2
process some fields
move to next record in recordset2
Loop
Close recordset2
move to next record in recordset1
Loop
Close recordset2
Can I have two Datareaders open on the same Dataconnection? I haven't
been able to find any reference to this. So I suspect it violates the
intended use of Datareaders, meaning short term usage. The code gives me
an error that the connection is already open, which is it. I can't close
the connection because the first recordset is still in process.
Can this be done with Datareaders or do I need to go to a Dataset? I'd
like to stay with Datareaders for now.
Thanks,
Bernie
My application is reading data out of an ODBC database for creating
reports. I'm using Datareaders because they are lighter weight and I only
need to read through the data once.
My problem is that as I run through the records in the data reader, I
need to open a second set of records depending on what I find in the
first record, example.
Open recordset1
Loop through recordset1
process some fields
Open recordset2
Loop through recordset2
process some fields
move to next record in recordset2
Loop
Close recordset2
move to next record in recordset1
Loop
Close recordset2
Can I have two Datareaders open on the same Dataconnection? I haven't
been able to find any reference to this. So I suspect it violates the
intended use of Datareaders, meaning short term usage. The code gives me
an error that the connection is already open, which is it. I can't close
the connection because the first recordset is still in process.
Can this be done with Datareaders or do I need to go to a Dataset? I'd
like to stay with Datareaders for now.
Thanks,
Bernie