Question and Answer Database FAQ1877C.txt Creating Pdox tables with AutoInc field programatically Category :VCL Platform :All Product :C++Builder 1.x Question: How to I create a Paradox table with an Auto Increment type field programatically? I'm using TTable->CreateTable, but TFieldType doesn't include this type. Answer: Use a TQuery and SQL CREATE TABLE statement. For example: void __fastcall TForm1::Button1Click(TObject *Sender) { Query1->DatabaseName = "BCDEMOS"; Query1->SQL->Clear(); Query1->SQL->Add("CREATE TABLE \"PDOXTBL.DB\" (ID AUTOINC,"); Query1->SQL->Add("Name CHAR(255),"); Query1->SQL->Add("PRIMARY KEY(ID))"); Query1->ExecSQL(); Query1->SQL->Clear(); Query1->SQL->Add("CREATE INDEX ByName ON \"PDOXTBL.DB\" (Name)"); Query1->ExecSQL(); } 7/2/98 10:32:32 AM
Last Modified: 01-SEP-99