how do i retrieve data from a table within a loop or something. That means I want to retrieve row by row at a time. but the sequence of rows may differ.
For example, 1st time i want 5rd row,then 2nd, then 9…so on.
I searched it through the internet. I got only two answers.
-
Use several SqlConnection objects.
-
reader= sqlCommand.ExecuteReader();
While(reader.Read()){
reader[“Column Name”].ToString();
}
If you got my problem, please help me
Thank you.
Sounds like you should correct your data layer to return the values in the order you are going to process them. It would be easiest and fastest! 🙂
As an alternative I’d suggest that you load your result into a DataTable:
/Alex