Ver Mensaje Individual
  #2  
Antiguo 30-08-2004
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Usa un StringList. Comienzas insertando una línea para el nombre del banco. Luego recorres el query formando la línea por cada registro tomando los datos de los campos individuales y al final guardas el archivo:

Código Delphi [-]
var
  List: TStringList;
  Line: String;

begin
  List := TStringList.Create;
  try
    List.Add('El banco de la ilusión');

    Query.First;
    while not Query.Eof do
    begin
      Line := Query.FieldByName('nombre').AsString;
      Line := Line + StringOfChar(' ', 10);
      Line := Line + Query.FieldByName('sueldo').AsString;

      List.Add(Line);
      Query.Next;
    end;

    List.SaveToFile('sueldos.txt');
  finally
    List.Free;
  end;
end;

// Saludos
Responder Con Cita