I’m not sure I understood what you mean exactly but I suppose you are using SQL queries to read your data.
So I suggest you using a query as the following:
<pre>SELECT (ROW_NUMBER() OVER (ORDER BY YourField ASC)) as MyCounter , FieldA, Fieldb
That will number the returned rows with increments.
<pre>1 –result fielda — result fieldb
2 –result fielda — result fieldb
3 –result fielda — result fieldb
and so on.
Once you have built your query you can easily compare the results of the <i>MyCounter </i>field to match the one stored in your variable and proescute with your code.
I hope the examples above are clear enough and helpful to you, if it doesn’t please be more specific with table names and any additional data that may clarify exactly your needs.