ODBC 资料库连结函式库odbc_num_rows
取得传回列数目。语法: int odbc_num_rows(int result_id);传回值: 整数
 
内容说明 
本函式用来取得传回列的数目。参数 result_id 为 ODBC 传回 ID 值。若有错误发生则传回 -1。

解决方案 »

  1.   

    晕~~,没注意到是MFC 的ODBC   :)
      

  2.   

    用这个函数就行了,如果你要学MFC ODBC 的话,我强烈 建议你去看一看MSDN中的这两个类:CDatabase,CRecordset
    CRecordset::GetRecordCount
    long GetRecordCount( ) const;Return ValueThe number of records in the recordset; 0 if the recordset contains no records; or –1 if the record count cannot be determined.ResCall this member function to determine the size of the recordset. Caution   The record count is maintained as a “high water ” — 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. 
      

  3.   

    晕,是MFC的问题~
    下面这样不知道行不行?
    m_pSet->MoveLast();
    long lRecordCount = m_pSet->GetRecordCoun();