4
The code below creates the txt file but does not write to it. Which may be?
procedure TForm1.Button4Click(Sender: TObject);
var
arq: TextFile;
begin
qr.Active:= true;
qr.First;
try
AssignFile(arq, 'd:\\tabuada.txt');
Rewrite(arq);
writeln(arq, 'teste');
while not qr.Eof do
begin
writeln(arq, qr.FieldValues['ine'] + ';' + qr.FieldValues['cmp'] + ';' + qr.FieldValues['cbo'] + ';' + qr.FieldValues['pa'] + ';' + qr.FieldValues['idade'] + ';' + '1;' + qr.FieldValues['quant'] + ';' + qr.FieldValues['profissional'] + ';' + qr.FieldValues['cnesdescricao'] + ';' + qr.FieldValues['cbodescricao'] + ';' + qr.FieldValues['padescricao']);
qr.Next;
end;
CloseFile(arq);
ShowMessage('ok2');
except
end;
end;
Shows no error and does not show ok2'
The fact of not showing error is due to you having a
Try..Except
without proper treatment. Put aShowMessage
no Except with theon E.Exception do
with the error message.– Andrey