How to use the Move method to get the record in a set of information?
    Move method will base on the current location     and move to the another record.
  For example:
    <%
  
Set conn = Server.CreateObject("Adodb.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")
Set rs = Server.CreateObject("Adodb.Recordset")
rs.open "User",conn,1,3
'When a recordset open a table, normally, the bookmark will point to the first record.
If NOT rs.EOF Then 'If the EOF is not true; which means it has some record in the table when you just opened the table
    
  rs.Move 5 'move     forward 5 records
rs.Move -2 'move backward 2 records
End If
rs.Close
    Set rs = Nothing
  
%>
    
  Another method will save the current bookmark location     and base on the bookmark we saved to perform some movements.
  The ASP codes are written and described as below:
  
    <%
  
Set conn = Server.CreateObject("Adodb.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")
Set rs = Server.CreateObject("Adodb.Recordset")
rs.open "User",conn,1,3
'When a recordset open a table, normally, the bookmark will point to the first record.
    If NOT rs.EOF Then 'If     the EOF is not true; which means it has some record in the table     when you just opened the table
  
    varMyBookmark = rs.Bookmark 'Save     the current bookmark
  
    rs.Move 5 'move     forward 5 records
  
    rs.Move 2, varMyBookmark 'Return     back to the bookmark that we saved, move to the record after it.
  
End If
rs.Close
    Set rs = Nothing
  
%>
No comments:
Post a Comment