Mega Code Archive

 
Categories / Delphi / ADO Database
 

How to create a paradox table by code

Title: How to create a paradox table by code Question: How to create a table at runtime with TTable. Answer: TTable has the capability for creating paradox tables without sql: with TTable.create(self) do begin DatabaseName := 'C:\projects\data'; TableName := 'Clients'; TableType := ttParadox; with FieldDefs do b begin Add('ID', ftInteger, 0, True); Add('FName', ftString, 25, False); Add('LName', ftString, 25, False); end; IndexDefs.Add('MainIndex','IntField', [ixPrimary, ixUnique]); CreateTable; end;