Recordset MoveLast

Discussion in 'ASP General' started by tony wong, Aug 14, 2005.

  1. tony wong

    tony wong Guest

    The asp return the number of lastrecord from MsSQL server

    the returned number is 229

    the last record number is 238

    anything goes wrong?

    anything can assist me to troubleshoot?

    Thanks a lot.

    Tony
    tony wong, Aug 14, 2005
    #1
    1. Advertising

  2. tony wong

    tony wong Guest

    i tried to move to the last record and move up (moveprevious) one by one.

    the number is 219,238,212,211,207,204,199,198,193,191,189,155

    how come they are not one by one.

    the number is generated by auto increment of SQL server in 1 step.

    any assistance? thanks.




    "tony wong" <> ¼¶¼g©ó¶l¥ó·s»D:%...
    > The asp return the number of lastrecord from MsSQL server
    >
    > the returned number is 229
    >
    > the last record number is 238
    >
    > anything goes wrong?
    >
    > anything can assist me to troubleshoot?
    >
    > Thanks a lot.
    >
    > Tony
    >
    tony wong, Aug 14, 2005
    #2
    1. Advertising

  3. tony wong wrote:
    > i tried to move to the last record and move up (moveprevious) one by
    > one.
    > the number is 219,238,212,211,207,204,199,198,193,191,189,155
    >
    > how come they are not one by one.
    >
    > the number is generated by auto increment of SQL server in 1 step.
    >
    > any assistance? thanks.
    >


    You failed to use an ORDER BY clause in the query used to retrieve your
    recordset. The only way to guarantee the order of te records retrieved from
    a relational database is to use an ORDER BY clause.

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Aug 14, 2005
    #3
  4. > The asp return the number of lastrecord from MsSQL server

    How are you defining "lastrecord"? There is no such thing as a "last row"
    unless you tell the database how you are defining "last"...

    If you want the biggest or most recent then you need to say something like:

    SELECT TOP 1 * FROM table ORDER BY something DESC

    If you would like a more specific answer, please see
    http://www.aspfaq.com/5006
    Aaron Bertrand [SQL Server MVP], Aug 15, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vikas Yadav
    Replies:
    0
    Views:
    1,121
    Vikas Yadav
    Sep 9, 2003
  2. Marcin Zmyslowski

    MoveFirst, MoveLast

    Marcin Zmyslowski, Aug 18, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    5,816
    Cathal Connolly [VB MVP]
    Aug 18, 2005
  3. Hung Huynh
    Replies:
    8
    Views:
    301
    Bob Barrows
    Sep 24, 2003
  4. joeandtel

    Can't use moveLast() function

    joeandtel, Feb 20, 2004, in forum: ASP General
    Replies:
    1
    Views:
    109
    Ray at
    Feb 20, 2004
  5. le0

    RcrdSet.MoveLast

    le0, Aug 24, 2006, in forum: ASP General
    Replies:
    2
    Views:
    134
    Bob Barrows [MVP]
    Aug 24, 2006
Loading...

Share This Page