You will need to continue using the same connection, query, and reader. In your for() loop, you restart the query each iteration... this method will return the first row every time it's run.
Also, you cannot use control variables the way you have: x will, by inspection, never reach the termination condition without generating an overflow exception.
What method are you using to connect your program to the database? Without knowing the datatypes being used, it's impossible to figure out how to fix it.
|