Add a field named index to the DBF table
There is a dbf table with a foam structure.
It is necessary to add a field with the name index.
Variants
- UniQuery->SQL->Text ="ALTER TABLE \""+System::Ioutils::TPath::GetFileNameWithoutExtension(OpenDialog->FileName)+"\" ADD COLUMN &fldname CHAR(10);";
- UniQuery->MacroByName("fldname")->AsString = "index";
- UniQuery->ExecSQL();
or
- UniQuery->SQL->Text ="ALTER TABLE \""+System::Ioutils::TPath::GetFileNameWithoutExtension(OpenDialog->FileName)+"\" ADD COLUMN `index` CHAR(10);";
- UniQuery->ExecSQL();
add the index field with double quotes - "index"
- UniTable1->Close();
- TField* Field;
- UniTable1->FieldDefs->Update();
- Field = new TStringField(UniTable1);
- Field->FieldName = "index";
- Field->Size = 10;
- Field->FieldKind = fkData;
- Field->Name = UniTable1->Name + Field->FieldName;
- Field->DataSet = UniTable1;
- UniTable1->FieldDefs->Update();
- UniTable1->Open();
Error - UniTable1 Field "index" not found
Help solve the problem.
Thank you.