Share via


CRecordset::GetRecordCount

Determines the size of the recordset.

long GetRecordCount( ) const;

Return Value

The number of records in the recordset; 0 if the recordset contains no records; or –1 if the record count cannot be determined.

Remarks

Warning

The record count is maintained as a "high water mark," the highest-numbered record yet seen as the user moves through the records. The total number of records is only known after the user has moved beyond the last record. For performance reasons, the count is not updated when you call MoveLast. To count the records yourself, call MoveNext repeatedly until IsEOF returns nonzero. Adding a record via CRecordset:AddNew and Update increases the count; deleting a record via CRecordset::Delete decreases the count.

Requirements

Header: afxdb.h

See Also

Reference

CRecordset Class

Hierarchy Chart

CRecordset::MoveLast

CRecordset::MoveNext

CRecordset::IsEOF

CRecordset::GetStatus