Name

Recordset.NextRecordset Method — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

Set resulting_recordset = recordset.NextRecordset(RecordsAffected)

The NextRecordset method of the Recordset object returns the next recordset by advancing through a series of commands:

recordset.MoveFirst

Arguments

RecordsAffected (Long)

Set to the number of records that the current operation affected. The data provider does this.

Description

Use the NextRecordset method of the Recordset object to obtain the next recordset in a compound command statement or a stored procedure that returns multiple results. An example of a compound command statement is:

SELECT * FROM upstairs; SELECT * FROM downstairs

The recordset that is originally created with either the Execute or Open methods returns a Recordset object based only on the first SQL statement in this compound statement. You must call NextRecordset to obtain each additional recordset. If the Recordset object is closed and there are remaining statements, those statements will never be executed.

The NextRecordset method continues to return recordsets as long as there are more in the list. If a row-returning statement successfully executes, and the result is zero records, then the Recordset object’s EOF and BOF properties are both be set to True. If a non-row-returning statement successfully executes, then the Recordset object should not be set to Nothing, but the EOF property should be True.

If there are no more statements in the compound command statement, the returned ...

Get ADO: ActiveX Data Objects 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.