Ver Mensaje Individual
  #4  
Antiguo 23-10-2004
Avatar de marcoszorrilla
marcoszorrilla marcoszorrilla is offline
Capo
 
Registrado: may 2003
Ubicación: Cantabria - España
Posts: 11.221
Reputación: 10
marcoszorrilla Va por buen camino
Prueba con este otro ejemplo a ver si es lo que pides:
Código Delphi [-]
 implementation
 
 {$R *.DFM}
 procedure QueryToCSV(QueryName:TQuery);
 var
 i,j: integer; (*i-field, j-record*)
 s: string; (*Record string*)
 theStringList: Tstringlist; (*temp storage*)
 
 begin
 s:='';
 theStringList:=TStringList.Create;
 
   with QueryName do
   begin
   try
   Active:=True;
   except
   showmessage('No puedo abrir la consulta '+ Name);
   end;
 
     for j:=0 to (RecordCount-1) do
     begin
       s:='';
         for i:=0 to (FieldCount-1) do
         begin
         (*add next field w/comma delimiter*)
         s:=s+(Fields[i].AsString)+',';
         end; (*i for*)
       theStringList.add(s);
       Next;
     end; (*i for*)
 
   theStringList.savetofile('D:\MiTxt.csv'); (*memo1.lines.*)
   Showmessage('El Archivo MiTxt.CSV se creó con exito.');
   close;
   end; (*with*)
 end; (*BackupTableToCSV*)
 
 procedure TForm1.Button1Click(Sender: TObject);
 begin
  QueryToCSV(Query1);
 end;

Un Saludo
__________________
Guía de Estilo de los Foros
Cita:
- Ça c'est la caisse. Le mouton que tu veux est dedans.
Responder Con Cita