Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-03-30
2
Medium Priority
?
265 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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

721 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