Sql select next/previous
Posted on 2006-06-12
I've created two functions, one to select the next item and one to select the previous item from a sql table using the item code. The problem is that when the user inputs the first item and I call the GetPrevious function, I get an exception saying "There's no row at position 0." Same exception when the users inputs the last item and I call the GetNext function.
I cannot know what the first and last item are when I call the functions. Is there any way I can catch this error? Maybe in the SQL statement itself?