Board index » delphi » ASCII text files to Paradox table

ASCII text files to Paradox table

I am looking for a way to take an ASCII, comma delimited text file and port
into a paradox db.  Anyone done anything like this before.  Thanks in advance.

Jay
LShepar...@DT-Online.com

 

Re:ASCII text files to Paradox table


You can always use the Text File Driver but this is pretty much useless
because it can miss out on many of the problems you can get with Delimiters.
The best way is to code it manually.
Load it into a StringList and split up manually.

Quote
LShepardjr wrote in message

<20000907154728.01324.00000...@ng-ff1.aol.com>...
Quote
>I am looking for a way to take an ASCII, comma delimited text file and port
>into a paradox db.  Anyone done anything like this before.  Thanks in
advance.

>Jay
>LShepar...@DT-Online.com

Re:ASCII text files to Paradox table


Use:

procedure ReadDataSetFromFile(const FileName: String; const DataSet:
TDataSet);
var
  F: TextFile;
  L: String;
  S: TStrings;
  i, j: Integer;
begin
  FileMode := 0;
  AssignFile(F, FileName);
  Reset(F);
  try
    S := TStringList.Create;
    try
      while not EOF(F) do
      begin
        ReadLn(F, L);
        S.CommaText := L;
        j := DataSet.FieldCount;
        if j > S.Count then
          j := S.Count;
        DataSet.Edit;
        try
          for i := 0 to j - 1 do
            DataSet.Fields[i].AsString := S[i];
          DataSet.Post;
        except
          DataSet.Cancel;
        end;
      end;
    finally
      S.Free;
    end;
  finally
    CloseFile(F);
  end;
end;

"LShepardjr" <lshepar...@aol.com> schreef in bericht
news:20000907154728.01324.00000034@ng-ff1.aol.com...

Quote
> I am looking for a way to take an ASCII, comma delimited text file and
port
> into a paradox db.  Anyone done anything like this before.  Thanks in
advance.

> Jay
> LShepar...@DT-Online.com

Re:ASCII text files to Paradox table


Thanks.  I'll try it.

Other Threads