INFO: GetRecordCount May Not Return Correct Number of Records (165563)



The information in this article applies to:

  • Microsoft Visual C++ 4.0
  • Microsoft Visual C++ 4.1
  • Microsoft Visual C++, 32-bit Enterprise Edition 4.2
  • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
  • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
  • Microsoft Visual C++, 32-bit Professional Edition 4.2
  • Microsoft Visual C++, 32-bit Professional Edition 5.0
  • Microsoft Visual C++, 32-bit Professional Edition 6.0
  • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q165563

SUMMARY

CDaoRecordset::GetRecordCount is not guaranteed to return the correct number of rows for a table-type recordset even if you call this function after calling MoveLast().

MORE INFORMATION

You can call CDaoRecordset::GetRecordCount to find out how many records in a recordset have been accessed. GetRecordCount does not indicate how many records are contained in a dynaset-type or snapshot-type recordset until all records have been accessed. To force the last record to be accessed, call the MoveLast function.

The value of GetRecordCount from a table-type recordset reflects the approximate number of records in the table. To get an accurate record count, open a dynaset- or snapshot-type recordset and then do a MoveLast. Table-type recordsets will be accurate immediately after the database has been compacted or repaired.

REFERENCES

Visual C++ Help; search on: CDaoRecordset::GetRecordCount

Modification Type:MajorLast Reviewed:12/2/2003
Keywords:kbDatabase kbusage KB165563