PAGUE 6 MESES
LEVE 12 MESES
GARANTIR DESCONTO

Fórum Passando de GDB para TXT - O que tem de errado? #227395

21/04/2004

0

Estou usando esse procedimento pra exportar do meu banco... para um arquivo txt.. a pessoa é quem escolhe qual tabela deseja usar..
O resultado do TXT é 1, 2, 3, 4, 5, 6, 7 sempre o número de registros que tem na tabela escolhida pelo usuario!!!

procedure TForm1.btn_exportaClick(Sender: TObject);
var f: TextFile;
i: Integer;
txt: TStringList;
Begin
txt := TStringlist.Create;
AssignFile(f, ´c:\´ + edt_nometabela.Text + ´.txt´);
Rewrite(f);
if FileExists(´c:\´ + edt_nometabela.Text + ´.txt´) then
begin
for i:= 1 to IBQuery.FieldCount - 1 do
begin
txt.add(IBQuery.Fields[i].FieldName + ´;´);
end;
IBQuery.First;
while not IBQuery.Eof Do
begin
for i:= 1 to IBQuery.FieldCount - 1 do
begin
writeln(f, txt.add(IBQuery.FieldByName(IBQuery.Fields[i].FieldName).AsString));
end;
// Writeln(f, txt);
IBQuery.Next;
end;
end;
CloseFile(f);
end;


Feliperodrigues

Feliperodrigues

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar