Click here to Skip to main content
11,645,349 members (80,146 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
int counter=0;
int Field_One=0;
bool end = false
selection[0]= mpset->First_Field
 
mpset->MoveFirst();
 
While(!end)
 
{
if(selection[counter] >0)
    {
     Field_One++;
    }
 
mpset->MoveNext();
end = mpset->IsEOF();
}
 

 

 
Here is a sample of the code. It reads the first field of each record and should move on to next record until all records completed.

Hi all

I have a problem navigating my access DB , I am using the commands MoveFirst(); and MoveNext(); and checking for end of file with m_pSet->IsEOF();

What is happenng is I am running the prog and I am only reading the first record values repeatedly on running the program even though EndofFile gets set at the end of the recordset. So it is going through the recordset but not acknowledging the values in each record only the first.

I rerun the program and it goes to the last record. I have 21 fields in each record.

Can anybody help please ?
Posted 22-Feb-13 10:07am
Edited 23-Feb-13 0:06am
v2
Comments
ThePhantomUpvoter at 22-Feb-13 17:17pm
   
Post some code that demonstrates your problem.
CPallini at 23-Feb-13 6:09am
   
Where are you actually reading the values? What is 'While'?
Jakey777 at 23-Feb-13 6:21am
   
While end is not true, a loop to go through the records
Jakey777 at 23-Feb-13 6:21am
   
Reading from access 97 DB table

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you only set the pointer of your reader - you need to "read" the data from the actual position in your data:

maybe this code needs to be added

selection[counter]= mpset->First_Field
  Permalink  
Comments
Jakey777 at 26-Feb-13 10:30am
   
Thanks KarstenK I needed to get this code inside the while loop as I was only reading the data from the first record into selection and then going throught the recordset. On rerun of prog record pointer was on last record so this was read in.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 jyo.net 814
1 OriginalGriff 650
2 Sergey Alexandrovich Kryukov 438
3 CPallini 436
4 Afzaal Ahmad Zeeshan 418
0 OriginalGriff 1,065
1 Sergey Alexandrovich Kryukov 703
2 Afzaal Ahmad Zeeshan 702
3 DamithSL 681
4 CPallini 595


Advertise | Privacy | Mobile
Web02 | 2.8.150731.1 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100