有这么一段程序:
procedure TForm5.ComboBox1Change(Sender: TObject);
var
i:integer;
bname:string;
begin
i:=combobox1.ItemIndex;
bname:=combobox1.Items.Strings[i]+'.dbf';
table1.tablename:=bname;
table1.active:=true;
end;
目的是想实现通过combobox来显示不同表的内容,但第二次选择combobox中的表名时会出现"无法在打开的数据集上操作",我不知道如何解决这个问题,请各位指教.
procedure TForm5.ComboBox1Change(Sender: TObject);
var
i:integer;
bname:string;
begin
i:=combobox1.ItemIndex;
bname:=combobox1.Items.Strings[i]+'.dbf';
table1.tablename:=bname;
table1.active:=true;
end;
目的是想实现通过combobox来显示不同表的内容,但第二次选择combobox中的表名时会出现"无法在打开的数据集上操作",我不知道如何解决这个问题,请各位指教.
procedure TForm5.ComboBox1Change(Sender: TObject);
var
i:integer;
bname:string;
begin
table1.tablename:='';
table1.active:=false;
i:=combobox1.ItemIndex;
bname:=combobox1.Items.Strings[i]+'.dbf';
table1.tablename:=bname;
table1.active:=true;
end;
var
i:integer;
bname:string;
begin
i:=combobox1.ItemIndex;
bname:=combobox1.Items.Strings[i]+'.dbf';
Table1.Active:=False;//这句是关键,cg1120的代码也有这个问题,不能改
//打开的Table的Name
table1.tablename:=bname;
table1.active:=true;
end;