Board index » delphi » Exporting data to ASCII format

Exporting data to ASCII format

Is there any way of exporting a Visual DBase data file (.dbf) to an ASCII
file (.txt), via code, in Delphi 5?

Thanks in advance,

Paul
data...@otenet.gr

 

Re:Exporting data to ASCII format


How About Trying somthing like this:
   Var
   ExportFile:TextFile;
   FieldLoop:Integer;
 QueryFieldValue,ExportRecord:String
   Begin
 Query1.Open;{Set your sql up}
{Export File Name}
   AssignFile(ExportFile,'ExportFile.txt');
   Rewrite(ExportFile);
   While (Query1.EOF=False) Do
       Begin
            ExportRecord:='';
            For FieldLoop := 0 to Query1.FieldCount - 1 Do
                Begin
                    {Details}
                     QueryFieldValue:='';
                     If VarIsNull(Query1.[FieldLoop].Value)=False Then
QueryFieldValue:=Query.Fields[FieldLoop].Value
                     ExportRecord:=ExportRecord+QueryFieldValue+',';
                End
       ExportRecord:=Copy(ExportRecord,1,Length(ExportRecord)-1);
       WriteLn(ExportFile,ExportRecord);
      {Next}
      Query1.Next;
       End;

Quote
DataCom <data...@otenet.gr> wrote in message

news:83fh7k$cm73@forums.borland.com...
Quote
> Is there any way of exporting a Visual DBase data file (.dbf) to an ASCII
> file (.txt), via code, in Delphi 5?

> Thanks in advance,

> Paul
> data...@otenet.gr

Re:Exporting data to ASCII format


Quote
>Is there any way of exporting a Visual DBase data file (.dbf) to an ASCII
>file (.txt), via code, in Delphi 5?

You can use a batchMove component to create an AScii file  just make the target
table a table  of type TTAscii.   This gives you a fixed length ASCII file.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads