Additional
AnyDAC
SimpleIAX
Forums
Welcome, Guest
Please Login or Register to post messages. Lost Password?
ADQuery Eof doesn't work?
(1 viewing) 1 Guest
Go to bottom
TOPIC: ADQuery Eof doesn't work?
#21087
burkeandrewj
Fresh Boarder
Posts: 5
graphgraph
Karma: 0
User Offline Click here to see the profile of this user
ADQuery Eof doesn't work? 2012/05/20 10:22 (12 Months ago)
"TADQuery *MetaQuery"

Everything works except "MetaQuery->Eof". When it gets to the last record instead of breaking out of the while statement, it repeats forever the last record??? Driving me crazy...Any sugestions? Thanks

Code:

Mod->MetaQuery->FindFirst();
 while(!Mod->MetaQuery->Eof)   //fix
{
field = Mod->MetaQuery->Fields->Fields[0]->AsString ;
item2 = Tree->Items->AddChild(item,field);
item2->ImageIndex = 7;
item2->Focused = true;

for (f=1;f<Mod->MetaQuery->Fields->Count ;f++)
{
Tree->Cells[f][item2->AbsoluteIndex]= Mod->MetaQuery->Fields->Fields[f]->AsString;
}

Mod->MetaQuery->FindNext();
}

Logged Logged
Last Edit: 2012/05/20 10:34 By Support.
The administrator has disabled public write access.
#21089
Support
Moderator
Posts: 5635
graph
Karma: 99
User Offline Click here to see the profile of this user
Re:ADQuery Eof doesn't work? 2012/05/20 10:38 (12 Months ago)
Hello

When FindNext does not found a record, then the current dataset position remains unchanged. So, staying on the last record, Eof is False. FindNext fails, position remains unchanged, Eof remains False.

With FindFirst / FindNext you should use Found property instead of Eof.
With best regards,
DA-SOFT Technologies Support Team
Logged Logged
The administrator has disabled public write access.
#21091
burkeandrewj
Fresh Boarder
Posts: 5
graphgraph
Karma: 0
User Offline Click here to see the profile of this user
Re:ADQuery Eof doesn't work? 2012/05/20 10:49 (12 Months ago)
I just found an answer myself by replacing FindFirst() with First() and FindNext() with Next() evidently FindNext doesn't Set Eof....Thanks
Logged Logged
The administrator has disabled public write access.
Go to top