Name
MoveFirst, MoveLast, MoveNext, MovePrevious (Recordset Object) —
rsObj
.{MoveFirst | MoveLast | MoveNext | MovePrevious}
Synopsis
Moves the record pointer to the first record of the recordset, to the last record of the recordset, forward one position, or backward one position, respectively.
Parameters
None
Example
The following example demonstrates how to use the MoveNext method to move the current record pointer to a position five records after the current record. You use the other navigational methods in exactly this same manner. (Note that this is not the most efficient manner to move the current record five positions forward.)
<%@ LANGUAGE="VBSCRIPT" %>
<% Response.Buffer = True %>
<HTML>
<HEAD>
<TITLE>ADO Examples</TITLE>
</HEAD>
<BODY>
<%
' Include ADOVBS.INC so we can use the ADO constants.
%>
<!-- #include virtual = "/bc_SSIncludes/adovbs.inc" -->
<%
' Instantiate an ADO Connection object.
Set objDBConn = Server.CreateObject("ADODB.Connection")
' Construct the connection string for the Connection object.
strConn = _
"driver={MyDBType};;uid=sa;pwd=;database=SalesDB"
' Using the connection string, open the connection.
objDBConn.Open strConn
' Create a command text string.
strCommandText = _
"SELECT * FROM Sales WHERE Price > 70000"
' Create a read-only, forward-only recordset using the
' Execute method of the connection object. Note that we
' have no AffectedRecords parameter.
Set rsSales = objDBConn.Execute strCommandText, , _
adCmdText
' Move to a record five after the ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access