July 2000
Intermediate to advanced
492 pages
14h 53m
English
MaxRecords (Recordset Object) —
rsObj
.MaxRecords (=
lngNumRecords
)
Specifies the maximum number of records returned from a command. If set to zero (0), this property indicates that the data provider should return all records that meet the criteria in the command. This is the default.
lngNumRecords
A Long value that represents the maximum number of records you want returned from your command against the database.
The following example sets the MaxRecords property so that it returns only four records.
<%@ 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 = "/MySSIncludes/adovbs.inc" -->
<%
' Instantiate an ADO Connection object.
Set objDBConn = Server.CreateObject("ADODB.Connection")
' Construct the connection string for the Connection object.
strConn = _
"driver={SQL Server};;uid=sa;pwd=;database=SalesDB"
' Using the connection string, open the connection.
objDBConn.Open strConn
' Instantiate an ADO Recordset object.
Set rsHighSales = _
Server.CreateObject("ADODB.Recordset")
' Set the ActiveConnection property of the recordset.
rsHighSales.ActiveConnection = objDBConn
' Construct the SQL to be used to open the recordset.
strSQL = _
"SELECT Buyer, Price FROM Sales WHERE Price > 70000"
' Set the maximum number of records the data provider ' can return into your recordset to four records. rsHighSales.MaxRecords ...Read now
Unlock full access