Fórum Dbgrid em txt #159072
09/05/2003
0
Como faço para salvar os resultados mostrados em um dbgrid para um arquivo txt utilizando o savedialog.
Desde já,
Agradeço.
Desde já,
Agradeço.
Eduardo
Curtir tópico
+ 0
Responder
Posts
09/05/2003
Marcelo Saviski
Depende.
tente isso
[b:da70fbc9e6]var[/b:da70fbc9e6] texto : TStringlist;
i : integer;
[b:da70fbc9e6]begin[/b:da70fbc9e6]
[b:da70fbc9e6]try[/b:da70fbc9e6]
texto := T[b:da70fbc9e6]String[/b:da70fbc9e6]list.create(self);
texto.text := ´´;
query.first;
[b:da70fbc9e6]while[/b:da70fbc9e6] not query.EOF[b:da70fbc9e6] do[/b:da70fbc9e6]
[b:da70fbc9e6]begin[/b:da70fbc9e6]
[b:da70fbc9e6]for [/b:da70fbc9e6]i := 0[b:da70fbc9e6] to [/b:da70fbc9e6]query.fields.count - 1[b:da70fbc9e6] do[/b:da70fbc9e6]
[b:da70fbc9e6]begin[/b:da70fbc9e6]
texto.add(´´)
texto[i] := texto [i] + ´ , ´ + query.fields[i].text;
[b:da70fbc9e6]end[/b:da70fbc9e6];
[b:da70fbc9e6]end[/b:da70fbc9e6];
[b:da70fbc9e6]finaly[/b:da70fbc9e6]
texto.free;
[b:da70fbc9e6]end[/b:da70fbc9e6];
tente isso
[b:da70fbc9e6]var[/b:da70fbc9e6] texto : TStringlist;
i : integer;
[b:da70fbc9e6]begin[/b:da70fbc9e6]
[b:da70fbc9e6]try[/b:da70fbc9e6]
texto := T[b:da70fbc9e6]String[/b:da70fbc9e6]list.create(self);
texto.text := ´´;
query.first;
[b:da70fbc9e6]while[/b:da70fbc9e6] not query.EOF[b:da70fbc9e6] do[/b:da70fbc9e6]
[b:da70fbc9e6]begin[/b:da70fbc9e6]
[b:da70fbc9e6]for [/b:da70fbc9e6]i := 0[b:da70fbc9e6] to [/b:da70fbc9e6]query.fields.count - 1[b:da70fbc9e6] do[/b:da70fbc9e6]
[b:da70fbc9e6]begin[/b:da70fbc9e6]
texto.add(´´)
texto[i] := texto [i] + ´ , ´ + query.fields[i].text;
[b:da70fbc9e6]end[/b:da70fbc9e6];
[b:da70fbc9e6]end[/b:da70fbc9e6];
[b:da70fbc9e6]finaly[/b:da70fbc9e6]
texto.free;
[b:da70fbc9e6]end[/b:da70fbc9e6];
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)