J
Jeremy
I execute a SqlDataReader to reader some data and am using
a while loop to read the data into a DataTable, and
essentially what I'm doing is making one call to the
database and reading the data into two seperate data
tables using a condition that I put into the while loop.
For example:
While SQLDataReader.Read And SQLDataReader("field") = false
'fill in false data table
End While
After this statement I want to move back the beginning and
read everything into a seperate data table with something
like:
While SQLDataReader.Read And SQLDataReader("field") = true
'fill in true data table
End While
However, I can't seem to figure out how to do something
like SQLDataReader.MoveFirst() before I try to fill in the
second data table. I get an error that says "Invalid
attempt to read when no data is present." However, I know
the data I want is in the database, so I am pretty sure I
need to move to the first record and read through it again.
Can somebody please help me figure out the best way I
should approach this? Would it be better to use two
seperate calls to the database?
Thanks,
Jeremy
a while loop to read the data into a DataTable, and
essentially what I'm doing is making one call to the
database and reading the data into two seperate data
tables using a condition that I put into the while loop.
For example:
While SQLDataReader.Read And SQLDataReader("field") = false
'fill in false data table
End While
After this statement I want to move back the beginning and
read everything into a seperate data table with something
like:
While SQLDataReader.Read And SQLDataReader("field") = true
'fill in true data table
End While
However, I can't seem to figure out how to do something
like SQLDataReader.MoveFirst() before I try to fill in the
second data table. I get an error that says "Invalid
attempt to read when no data is present." However, I know
the data I want is in the database, so I am pretty sure I
need to move to the first record and read through it again.
Can somebody please help me figure out the best way I
should approach this? Would it be better to use two
seperate calls to the database?
Thanks,
Jeremy