Click here to Skip to main content
15,917,321 members
Please Sign up or sign in to vote.
1.00/5 (1 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
Updated 23-Feb-13 0:06am
v2
Comments
[no name] 22-Feb-13 17:17pm    
Post some code that demonstrates your problem.
CPallini 23-Feb-13 6:09am    
Where are you actually reading the values? What is 'While'?
Jakey777 23-Feb-13 6:21am    
While end is not true, a loop to go through the records
Jakey777 23-Feb-13 6:21am    
Reading from access 97 DB table

1 solution

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
 
Share this answer
 
Comments
Jakey777 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900