an error in CRecordSet member function 
Author Message
 an error in CRecordSet member function

Hi EveryOne:

        I found there is something wrong in the MFC CRecorSet , the function
GetRecordCount() is not run as it describes in the help file. it does not
return the number of records fulfill the m_strFilter, it returns always 1 if
there is some records fulfill, 0 else.

                 AM I Right?

                           Cheng Yi



Wed, 31 Jan 2001 03:00:00 GMT  
 an error in CRecordSet member function
It's not an error. The reason for this is clearly documented: Quoting from
the docs for CRecordSet::GetRecordCount():

Caution   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.

Tomas Restrepo

http://www.geocities.com/SiliconValley/Heights/3401


Quote:
>Hi EveryOne:

>        I found there is something wrong in the mfc CRecorSet , the
function
>GetRecordCount() is not run as it describes in the help file. it does not
>return the number of records fulfill the m_strFilter, it returns always 1
if
>there is some records fulfill, 0 else.

>                 AM I Right?

>                           Cheng Yi



Wed, 31 Jan 2001 03:00:00 GMT  
 an error in CRecordSet member function
The function GetRecordCount() doesn't return the number of records fulfill
the m_strFilter. If you read the note "Caution"  you can see it.

"Caution   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. "



Wed, 31 Jan 2001 03:00:00 GMT  
 an error in CRecordSet member function
See the advise I gave just a couple of messages below.


Wed, 31 Jan 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. static function access member variable and member function

2. Error upon executing CRecordset::Open function

3. CRecordset function Update error

4. C2086 error: static local variables in member functions

5. VC++ error: Derived class Virtual member functions.

6. template member function - non template class - VC5 - error

7. Passing the address of a member function error

8. Illegal call of non-static member function (error)?

9. Error trying to access a derived member function from the base class

10. Error C2352 - illegal call of non-static member function

11. PostMessage compile error: non-static member function

12. Compiler Error C2352: illegal call of non-static member function

 

 
Powered by phpBB® Forum Software