Hello,
I have an asp.net application that will use a SQL Server DBMS for the
backend.
On my asp.net form. I have a next, previous, last and first buttons on my
form.
Basically, this application will allow the user to page through some data
one record at a time.
Let's say my SQL statement returns the following rows with ID's of (1, 3,
5, 9, 10).
What would be the best way that I can always retrieve the previousID and
nextID according to the rows my Select SQL statement returned?
Thanks,
Mark
Hector Obregon [eMVP] - 04 Aug 2005 19:34 GMT
If your records are sorted by ID you could use
YourDataSet.Tables["YourTable"].Rows[0]["ID"] to get the first ID and
YourDataSet.Tables["YourTable"].Rows[DataSet.Tables["YourTable"].Rows.Count
- 1]["ID"] to get the last one. Then when the user requests another page you
could use the appropriate value in a WHERE clause to get the corresponding
set.
I am sure there are other and maybe better ways too.
Cheers,
Hector
> Hello,
>
[quoted text clipped - 12 lines]
> Thanks,
> Mark