Ver Mensaje Individual
  #6  
Antiguo 15-04-2009
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - Espańa
Posts: 19.439
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Posiblemente el TXT (CSV) sea el más sencillo.
Basta con un WHILE + un FOR, uno para el recorrido y otro para los campos.

Algo así, aunque deberás afinarlo más...

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
  i, j:Integer;
  fName:string;
  TS:TStrings;
  str:string;
  typ:TFieldType;
begin
  ADOTable1.Open;
  TS := TStringList.Create();
  fName := IncludeTrailingBackslash(ExtractFilePath(Application.ExeName)) + 'export.txt';

  // Recorrido
  while not ADOTable1.Eof do begin

    Str := '';
    for i := 0 to (ADOTable1.Fields.Count - 1) do begin

      // Tipo Correcto
      typ := ADOTable1.Fields[i].DataType;

      if (typ = ftString) or (typ = ftSmallint) or (typ = ftInteger) or
         (typ = ftWord) or (typ = ftBoolean) or (typ = ftFloat) or
         (typ = ftLargeInt) or (typ = ftDate) or (typ = ftDateTime) or
         (typ = ftCurrency) or (typ = ftWideString) then begin

        Str := Str + ADOTable1.Fields[i].AsString;
        if (i <> ADOTable1.Fields.Count) then begin
          Str := Str + ',';
        end;
      end;


    end;
    TS.Add(Str);

    ADOTable1.Next;
  end;

  Memo1.Lines.AddStrings(TS);
  TS.SaveToFile(fName);


  FreeAndNil(TS);
  ADOTable1.Close();
end;
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita