共用方式為


CRecordset::GetRowsFetched

Determines how many records were actually retrieved after a fetch.

DWORD GetRowsFetched( ) const;

Return Value

The number of rows retrieved from the data source after a given fetch.

Remarks

This is useful when you have implemented bulk row fetching. The rowset size normally indicates how many rows will be retrieved from a fetch; however, the total number of rows in the recordset also affects how many rows will be retrieved in a rowset. For example, if your recordset has 10 records with a rowset size setting of 4, then looping through the recordset by calling MoveNext will result in the final rowset having only 2 records.

To implement bulk row fetching, you must specify the CRecordset::useMultiRowFetch option in the dwOptions parameter of the Open member function. To specify the rowset size, call SetRowsetSize.

For more information about bulk row fetching, see the article Recordset: Fetching Records in Bulk (ODBC).

Example

CMultiCustomer rs(&m_dbCust);

// Set the rowset size
rs.SetRowsetSize(5);

// Open the recordset
rs.Open(CRecordset::dynaset, NULL, CRecordset::useMultiRowFetch);

// loop through the recordset by rowsets 
while(!rs.IsEOF())
{
   for(int rowCount = 0; rowCount < (int)rs.GetRowsFetched(); rowCount++)
   {
      // do something
   }

   rs.MoveNext();
}

rs.Close();

Requirements

Header: afxdb.h

See Also

Reference

CRecordset Class

Hierarchy Chart

CRecordset::SetRowsetSize

CRecordset::CheckRowsetError