kuzmar
asked on
What is the previous or the next record in a database?
Hi. I am using C# and MS Access database in a web site.
I filter one element and display it.
How do I know which is the previous element (to be able to make some navigation) or the next element. Also need to know if it is a first element (in this case there is no previous element) or the last element (so there is no next element.)
thx
I filter one element and display it.
How do I know which is the previous element (to be able to make some navigation) or the next element. Also need to know if it is a first element (in this case there is no previous element) or the last element (so there is no next element.)
thx
The only way you're going to do that is to retrieve 3 records, the one you want to display, plus the one before and after, because you will need the id's from them to determine next/prev.
Unless you use an autoincrementing column. Then you can guess the previous (it may have been deleted so just keep trying smaller and smaller numbers till you get a hit)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
totaly forgot about it... thx