Code:
qr.ParamByName('mes').AsString:= edmes.Text;
qr.ParamByName('ano').AsString:= edano.Text;
qr.Active:= true;
qr.First;
try
AssignFile(arq, 'relatorio.txt');
Rewrite(arq);
showmessage(inttostr(qr.RecordCount));
while not qr.Eof do
begin
writeln(arq, qr.FieldValues['dt_ficha'] + ';' + qr.FieldValues['unidade'] + ';' + qr.FieldValues['profissional'] + ';' + qr.FieldValues['count']);
qr.Next;
end;
CloseFile(arq);
ShowMessage('Arquivo criado com sucesso!');
except
end;
The qr component runs correctly, showmessage informs me that it has 270 rows, but the while statement is only executed once (one line only).