Click here to Skip to main content
15,887,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello;

In a program there is an Access Table with a column of number type called ID_Number. The column is the primary key of the table. When I need to look for a specific record, I use the SELECT Command as below. I need to know the position of the record returned. For example I want to know if the returned record is the 3rd or 10th... row of the table.
Could you please let me know how I could get the position of the result in the table?

Thanks a lot

string Sql_Comnd = "Select * from MyTable WHERE ID_Number = 1537";
Posted
Comments
Bardy85 17-Sep-10 16:12pm    
It all depends. If you add an order by the whole index value will change.
Why exactly would you want to get the index value, and is the index value reletive to the ID if the ID's are sorted?
ahhashemi 18-Sep-10 1:26am    
Dear Bardy85
First I should thank you very much for reading my question, and then I should add that I need the index value (or position of the record or Record Number) so that I could navigate among the table records (by increasing or decreasing the index value). As an answer to the second question I should say that there is no relation between the primary key (ID_Number) and the associated index value.

1 solution

Did you see this tip ?

http://www.codeproject.com/Tips/53440/How-To-Select-Record-Based-on-Row-Number.aspx[^]

It produces the Row Number for the rows.
 
Share this answer
 
Comments
ahhashemi 18-Sep-10 0:50am    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900