creates a Paradox (5) table and write the data to it.

creates a Paradox (5) table and write the data to it.

Post by Blom » Sun, 31 Dec 1899 09:00:00



Does someone have a code example that read from a ODBC source (e.g. MS
ACCESS, MS FoxPro) and creates a Paradox (5) table and write the data to
it. PLESE HELP !
 
 
 

creates a Paradox (5) table and write the data to it.

Post by PD » Sun, 31 Dec 1899 09:00:00



Quote:>Does someone have a code example that read from a ODBC source (e.g. MS
>ACCESS, MS FoxPro) and creates a Paradox (5) table and write the data to
>it. PLESE HELP !

Hi! Here's a creation of a TTable with paradox.

***************************************************
  with Table1 do
  begin
    Active := False;  { The Table component must not be active }

    { First, describe the type of table and give it a name }
    DatabaseName := DBName;
    TableType := ttDefault;   {ttDefault will chose Paradox as standard}
    TableName := 'Person';

    { Next, describe the fields in the table }
    with FieldDefs do
    begin
      Clear;
      Add('ID', ftAutoInc, 0, True);
      Add('TYPE', ftInteger, 0, False);
      Add('ABBREVIATION', ftString, 15, false);
    end;

    with IndexDefs do
    begin
      Clear;
      Add('', 'ID', [ixPrimary, ixUnique]); { The first index has no name
because it is a Paradox primary key }
      Add('ixTYPE', 'TYPE', [ixCaseInsensitive]);
      Add('ixABBREVIATION', 'ABBREVIATION', [ixCaseInsensitive]);
    end;

    CreateTable;
  end;

***************************************************

Concerning accesing Access, the whole trick I guess is to chose the right
DatabaseName (which is not just a name but an alias created in the BDE that
comes with Delphi).

After choosing the DatabaseName (the Alias will include a path to your
database folder) you can choose the table itself from the TableName, which
will become a drop down box. No big deal, really.

Kind regards
Poul