同上

解决方案 »

  1.   

    A recordset with no records returns a value of 0. When working with attached tables or ODBC databases, GetRecordCount always returns – 1. Calling the Requery member function on a recordset resets the value of GetRecordCount just as if the query were re-executed.来自MSDN
      

  2.   

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

  3.   

    用ADO的吗?
    如果是,就把游标设为adUseClient
    pRecordset->CursorLocation = adUseClient;
      

  4.   

    这个问题是微软的一个Bug,可以换种方式来计算记录集的数量!如:
    int count = 0;
    pRecordset->MoveFirst();
    while(!pRecordset->EOF)
    {
      count++;
      pRecordset->MoveNext();
    }
      

  5.   

    GetRecordCount前MoveLast一下
    pRecordset->MoveLast();