Author: Tomas Rutkauskas
How do I create a Paradox table with an Auto Increment type field programmatically?
I'm using TTable.CreateTable, but TFieldType doesn't include this type.
Answer:
Use a TQuery and SQL CREATE TABLE statement. For example:
1 procedure TForm1.Button1Click(Sender: TObject);
2 begin3 with Query1 do4 begin5 DatabaseName := 'DBDemos';
6 with SQL do7 begin8 Clear;
9 Add('CREATE TABLE "PDoxTbl.db" (ID AUTOINC,');
10 Add('Name CHAR(255),');
11 Add('PRIMARY KEY(ID))');
12 ExecSQL;
13 Clear;
14 Add('CREATE INDEX ByName ON "PDoxTbl.db" (Name)');
15 ExecSQL;
16 end;
17 end;
18 end;