Solved

CRecordset, EOF and BOF differences on Win2k vs. XP?

Posted on 2007-03-30
2
260 Views
Last Modified: 2013-11-20
I am suddenly having a problem. I am using V++ 6.0.  I execute a query that I am absolutely certain will return 1 record.  (in this case that is, there are times it may not return anything, so I have to check for empty, but the problem is when it does)

I check if it's got any data using the following, which is the way I've always done it:

            if (!recset->IsEOF() && !recset->IsBOF())

This has been working in debug and release on Win2k.. Suddenly I run it on XP and that line continued to fail, as if EOF and BOF were both true, as if there were no data returned.. I added traces and message box's and such using GetRecordCount, and in fact GetRecordCount() returned 1 while at the same time the above IF statement failed as if there were no records.

What's going on here?  I can replace that with:

             if (recset->GetRecordCount() > 0)

and be up and running again on both platforms, but I'm confused as to why it suddenly does not work? This is just in this one scenario as well, I use similar statements to check for empty record sets elsewhere in the app, and they continue to perform as expected.

Any thoughts??

Thanks
0
Comment
Question by:PMH4514
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 18825233
I use the following logic:
            if (! (recset->IsEOF() && recset->IsBOF()) )
0
 

Author Comment

by:PMH4514
ID: 18825853
well strangely enough using your version worked.

(strange in that I see no reason why mine didn't?)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
twoTwo  challenge 35 107
canBalance challenge 34 96
Setting nameservers after res_init fails doing res_query 2 109
wordmultiple challenge 12 141
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question