Does anyone know how to pass the current row of a DataReader as a paramater in the method call?
I have a datareader that is running through all the rows retrieved from the database. For each row, I perform some tasks. I'd like to move some of that code off into a method to make it cleaner. So it would look something like this;
while (myReader.read)
myMethod(the current row in the data reader)
end while
If I read all the rows into a datatable, I can do a for each row and pass the row to a method. I'm just curious if there is any way to do this with a datareader.
I'd rather not read all the rows into a table first, due to speed issues.
Bernie
I have a datareader that is running through all the rows retrieved from the database. For each row, I perform some tasks. I'd like to move some of that code off into a method to make it cleaner. So it would look something like this;
while (myReader.read)
myMethod(the current row in the data reader)
end while
If I read all the rows into a datatable, I can do a for each row and pass the row to a method. I'm just curious if there is any way to do this with a datareader.
I'd rather not read all the rows into a table first, due to speed issues.
Bernie