I've ran into this issue before, and know how to get around it, but I'd like to know if there is a property I'm missing, or better way.
My solution is to get a record count, then iterate by the count, vs looking for EOF.
Is there a better way?
What happens is the query result re-reads the Source.dbf AFTER the post. You never reach EOF, and the loop is infinite.
Consider the following code. For Simplicity, Source.dbf is a single record table, with a single field (named Field1). Field1 in Record 1 has the value of '123'.
procedure TForm1.Button1Click(Sender: TObject);
while not Qry.EOF do
tblSource.FieldByName('Field1').AsString := '123';
Qry := TAdsQuery.Create(self);
Qry.TableType := ttADSCdx;
Qry.DatabaseName := 'c:\project\windows\tools\StaticQuery';
Qry.SQL.Add('Select * from Source');
Qry.SQL.Add('where Field1 = ''123''');
tblSource := TAdsTable.Create(self);
tblSource.DatabaseName := 'c:\project\windows\tools\StaticQuery';
tblSource.TableName := 'Source.dbf';
tblSource.TableType := ttADSCdx;