DataReader cursor rewind
How do I rewind the cursor in the DataReader to the beginning?
With one DataReader result, I need to run two loops while
, but they must be from the beginning. These are two iterations on the same result set that runs the query once.
Example:
dr = command.ExecuteReader(cmd);
while (dr.Read()) {
// do some...
}
// rewind cursor here
while (dr.Read()) {
// do another things...
}
I looked through the DataReader docs and found nothing, so if this is not possible with the DataReader, I can change the class to one that suits the purpose.
+3
source to share