ADO » Recordset » MaxRecords

Syntax:
long = recordsetobject.MaxRecords
recordsetobject.MaxRecords = long

Sets or returns a long value that specifies the maximum number of records that can be returned to a Recordset object as the result of a query.

The MaxRecords property sets or returns a long integer that dictates the maximum number of records that a query can return. This can be useful when you do not know how many records might be returned by a query to a very large database. The default is zero which signifies that there is no maximum limit.

This value is passed to the provider and it is the responsibility of the provider to implement this limit. Note, this property has no effect on an Access database.

You can only set this property when the Recordset is closed (read/write when closed, read-only when open). Not all providers recognize this property.

Examples

Code:
Set rsChants = Server.CreateObject("ADODB.Recordset")
rsChants.MaxRecords = 5
strQuery = "SELECT * FROM GuruChantList"
rsChants.Open strQuery, , , adCmdTable

See Also: