Last record in database

Results 1 to 2 of 2

Thread: Last record in database

  1. #1
    Goran2 Guest

    Default Last record in database

    How do I go to the last record in database and read some values. I try this:<BR>sql="select * from table1"<BR>set rs=conn.execute(sql)<BR>rs.movelast<BR><BR>The result is an error in rs.movelast line. Is there a way to go directly to the last record, without looping trough database until EOF hapens?<BR>

  2. #2
    Saravanan T S Guest

    Default RE: Last record in database

    Hi Goran,<BR> The problem is in cursortype. When u open a recordset without the cursortype parameter then the default cursortype is adOpenForwardOnly. In this cursortype u can move the recordset one step at a time. i.e. u can use only movenext. All other options(movelast, moveprevious) will give a runtime error. So, change the cursortype to adOpenDynamic so that u can directly move to the last record and fetch values. <BR><BR>Include this line before opening the reocrdset..<BR><BR>rs.cursortype = adOpenDynamic<BR>set rs=conn.execute(sql)<BR><BR>This is the solution for this problem.<BR><BR>Let me the status.<BR><BR>Saravanan T S<BR>

Posting Permissions

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