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;

解决方案 »

  1.   


    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;
      

  2.   

    打开数据表“produce_type_t”,将其所有记录的前2个字段内容分别装入到dbcombobox1和dbcombobox2中
      

  3.   

    bdmh已經說的很清楚了,我就不說了