Solved

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

Posted on 2007-03-30
2
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

631 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