-1
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 tells me it has 270 lines, but the while command runs only once (one line only).
didn’t work. worse this procedure is simple and I’m not understanding which error...
– Italo Rodrigo
What is your version of Delphi? Have you programmed anything at any of the query events? Before
writeln
put thisShowMessage(IntToStr(qr.recno))
and see if the first time you enter you are in Recno 0 or 1– Matheus Ribeiro
using recno appears 1
– Italo Rodrigo
my version is rad studio 10.2
– Italo Rodrigo
I am using zeos to connect, the data is listed on the grid on the screen normally, only at the time of going through the file it does not do
– Italo Rodrigo
Check my answer again, change the
exception
As I showed, it is to be displayed the error, I believe it is giving error when saving your text file, so it passes only once. And one more thing... If you are in version 10.2 which is the most current, use the componentsFireDAC
instead of Zeos, they’re much better– Matheus Ribeiro
That’s right, thanks. is asking to convert a variable of type date (dt_plug) to string
– Italo Rodrigo
I’m using zeos that is free (my version of Delphi is a free, because I didn’t want to get pirate version), is it possible to install Firedac in it? can change your answer to me to give your points
– Italo Rodrigo
Edited response. Following logic, possibly its field
count
would give problem also for being whole (I believe). And in the case of free Delphi, so beauty, fireDAC is more for paid version even.– Matheus Ribeiro
That’s right, I’ve changed the field
count
also and I’m already using the system. hug ^^– Italo Rodrigo