Newbie- SQL ROWID problem

Discussion in 'Questions (Windows Mobile)' started by enonod, Oct 13, 2007.

  1. enonod

    enonod Well-Known Member Licensed User

    To keep control of records I am using...
    lLastRec=gPage*gRows
    ...and then SQL statement...
    SELECT * FROM Titles WHERE ROWID >0 AND ROWID <= lLastRec ORDER BY num

    The SQL error 'No such column lLastRec'
    suggests a variable cannot be used to compare ROWID. Having replaced it with a number and it works seems to confirm this.
    This obviously presents a problem when trying to obtain sets of data to display one page at a time to avoid having scrollbars appear on the Table. It means a number must manually be provided per page.

    I must have something wrong here.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    There should be no problem using a variable, but you need to use the concatenation operator:
    Cmd.CommandText = " SELECT * FROM Titles WHERE ROWID >0 AND ROWID <= " & ILastRec & " ORDER BY num"
     
  3. enonod

    enonod Well-Known Member Licensed User

    Thank you Erel.
     
Loading...