Name

RecordCount (Recordset Object) — rsObj .RecordCount

Synopsis

Provides you with the current number of records in the Recordset object (or the number of records in the Recordset object that meet the criteria in the Filter property, if one is supplied). If ADO cannot ascertain the total number of records, the value of this property is -1. The Recordset object must be open before you can retrieve a value for this property. Also, the Recordset object must be of a cursor type that supports movement (forward and backward) or it must be fully populated before the value for the RecordCount property is accurate.

Parameters

None

Example

<%@ 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 ' Set the recordset's cursor type to adOpenStatic so ' that the recordset supports the RecordCount property. rsHighSales.CursorType = adOpenStatic ...

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.