先CDaoRecordset::MoveLast();
然后再CDaoRecordset::GetRecordCount();
MSDN中有描述

解决方案 »

  1.   

    GetRecordCount does not indicate how many records are contained in a dynaset-type or snapshot-type recordset until all records have been accessed. This member function call may take a significant amount of time to complete.Once the last record has been accessed, the return value indicates the total number of undeleted records in the recordset. To force the last record to be accessed, call the MoveLast or FindLast member function for the recordset.