Results 1 to 2 of 2

Thread: Select "next"

  1. #1
    Join Date
    Jun 2001

    Unanswered: Select "next"

    Hi. is there any option to use a SELECT to get always the NEXT record without using CURSOR.

    Imagine the following Situation.
    a table with

    Custome Code , Invoice, Control Number, etc

    for each Customer there are a lot of records

    The user want to see one by one in the Forms
    he type Customer 49

    there are two Buttons Forward and BACK

    If I use this
    select Code, Invoice, etc from table
    where code > 49

    i will get 50 not customer 49 invoce 0001

    If i put Customer = 49 or >=
    i will always get the same.

    If use Cursor >= 49 , if the user Click BACK
    i dont get customer 48 because Cursor is limited to > 49


    C. Lages

  2. #2
    Join Date
    Oct 2001
    You need to pass to the SP the customer ID and last invoice number displayed

    select top 1 ...
    from table t1
    where customer = @customer
    and invoiceNo >@invoiceno
    order by invoiceNo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts