procedure TPut_Form.FormActivate(Sender: TObject);
begin
with adotable1 do
begin
tablename:='produce_type_t';
if not active then
active:=true;
first;
dbcombobox2.Items.Clear;
dbcombobox1.Items.Clear;
end;
while not adotable1.Eof do
begin
dbcombobox2.Items.add(adotable1.Fields.fields[0].asstring);
dbcombobox1.Items.add(adotable1.Fields.fields[1].asstring);
adotable1.next;
end;
dbcombobox2.ItemIndex:=0;
dbcombobox1.ItemIndex:=0;
end;
begin
with adotable1 do
begin
tablename:='produce_type_t';
if not active then
active:=true;
first;
dbcombobox2.Items.Clear;
dbcombobox1.Items.Clear;
end;
while not adotable1.Eof do
begin
dbcombobox2.Items.add(adotable1.Fields.fields[0].asstring);
dbcombobox1.Items.add(adotable1.Fields.fields[1].asstring);
adotable1.next;
end;
dbcombobox2.ItemIndex:=0;
dbcombobox1.ItemIndex:=0;
end;
procedure TPut_Form.FormActivate(Sender: TObject);
begin
with adotable1 do
begin
tablename:='produce_type_t'; //设置表名
if not active then
active:=true; //打开table
first; //指向第一条记录
dbcombobox2.Items.Clear; //清空items
dbcombobox1.Items.Clear;
end;
while not adotable1.Eof do //开始循环数据集
begin
dbcombobox2.Items.add(adotable1.Fields.fields[0].asstring); //添加字段值
dbcombobox1.Items.add(adotable1.Fields.fields[1].asstring);
adotable1.next; //下一个记录
end;
dbcombobox2.ItemIndex:=0;
dbcombobox1.ItemIndex:=0;
end;