CRecordset::GetRowsFetched

DWORD GetRowsFetched( ) const;

Return Value

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

Remarks

Call this member function to determine how many records were actually retrieved after a fetch. 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) in Visual C++ Programmer’s Guide.

Example

MultiRowSet rs;

// 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( );

CRecordset OverviewClass MembersHierarchy Chart

See Also   CRecordset::SetRowsetSize, CRecordset::CheckRowsetError