Επεξεργασία

Κοινή χρήση μέσω


Receiving Multiple Recordsets

The Microsoft OLE DB Provider for SQL Server supports returning multiple Recordset objects for a single command containing multiple SQL statements, one Recordset per SQL statement. The order in which the Recordsets are returned follows the order in which the SQL statements are placed in the command text.

The Microsoft OLE DB Provider for SQL Server also returns multiple resultsets to ADO when the command contains a COMPUTE clause. For example, a command containing the following SQL statement will return the results in two Recordset objects: one for the rowset of (ProductID, ProductName, UnitPrice), and the other for the average price of all products in the table.

SELECT ProductID, ProductName, UnitPrice   
  FROM PRODUCTS   
  COMPUTE AVG(UnitPrice)  

You can use the Recordset.NextRecordset method to enumerate the two objects.

For more information, see NextRecordset.