Код
procedure TForm9.Button1Click(Sender: TObject);
var i:integer;
s:string[30];
begin
Case pagecontrol1.ActivePageIndex of
0: begin
with mdb.DataModule2.Person do
begin
For i:=0 to form1.DBGrid1.FieldCount-1 do
If form1.DBGrid1.Columns[i].Title.Caption=radiogroup1.Items[radiogroup1.ItemIndex] then
begin
s:=form1.DBGrid1.Columns[i].FieldName;
break;
end;
end;
mdb.DataModule2.Person.AddIndex(s+'index',s,[]);
mdb.DataModule2.Person.IndexName:=s+'index';
end;
end;
end;
var i:integer;
s:string[30];
begin
Case pagecontrol1.ActivePageIndex of
0: begin
with mdb.DataModule2.Person do
begin
For i:=0 to form1.DBGrid1.FieldCount-1 do
If form1.DBGrid1.Columns[i].Title.Caption=radiogroup1.Items[radiogroup1.ItemIndex] then
begin
s:=form1.DBGrid1.Columns[i].FieldName;
break;
end;
end;
mdb.DataModule2.Person.AddIndex(s+'index',s,[]);
mdb.DataModule2.Person.IndexName:=s+'index';
end;
end;
end;
Пишет:
Invalid index\tag name
index does not exists
Index: MFioindex
Эксклюзивный доступ к таблице стоит.