How do I can rewind a cursor of a DataReader to the beginning?
With one DataReader result I need to run two while
loop, but those have to be from beginning. They are two iterations in one result set running a query once.
Example:
dr = command.ExecuteReader(cmd);
while (dr.Read()) {
// do some...
}
// rewind cursor here
while (dr.Read()) {
// do another things...
}
I've looked into the DataReader docs and I've found nothing, so if it can't be possible with DataReader, I may change the class for one that fits this purpose.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…