[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Retrieving record before and after

Morkai Kurst

6/6/2002 12:11:00 AM


I have a winform app that connects to a Paradox database using odbc.net. The
app is a stock information system we use for our sales staff to access
information about any product we sell.

Currently I have a form with a search box that allows a user to enter a
stock code and it fills the text boxes with corresponding data. What I want
to do is create a next and previous button however our stock codes don't run
in a rigid numerical order.

For example one code is 64E200. The 64E is a group reference that tells me
it is a water heater, a spare part may have an 18P group reference. Now
within the 64E group the numbers don't follow exactly, ie I might have
64E201 and 64E202 but the next number may well be 64E210. The ones in
between haven't been allocated yet.

I'm stuck on how to move to the next record. When I get the information for
the inputted reference I do an sql "SELECT * FROM stock WHERE ewhCode = " +
ewhRef

where ewhRef is what the user entered. Please note I don't actually use *, I
just wanted to keep the example simple.

How can I go from here to get the next record? The stock code is the primary
keyfield so the database is always sorted in the correct order so all I need
to do is get the next record and the one prior to it. I'm not sure how to do
this when I don't know what the next record number will be. It could even
get to the point where the next record is a new group completely ie
following 64E999 is 68E100 (each group starts at 100 regardless) or if
working on previous record prior to 64E100 is 46G999.

Hope that makes sense, any help would be appreciated even if its a pointer
to a more relevent group.

Thanks

Morkai