怎样在下拉列表框中显示数据表?具体怎么做?能不能中combobox,或者Dbcombobox中显示数据表.

解决方案 »

  1.   

    while ADODataSet1.Eof= false do
        begin
          combobox1.Items.Add(ADODataSet1.FieldValues['要显示的字段']);
          ADODataSet1.Next;
        end;
      

  2.   

    with ADOTable1 do
     begin
      while not eof do
        begin
         ComboBox1.Items.Add(ADOTable1.fieldbyname('字段').asstring);
         next;
        end;
     end;
      

  3.   

    while not table1.eof do 
    begin
      combobox1.items.add(table1.fieldbyname('aa').asstring);
      table1.next;
    end;
      

  4.   

    procedure Tdlfm.FormShow(Sender: TObject);
    begin  dm.temp.close ;
      dm.temp.commandtext:='select * from zhbysh ';
      dm.temp.open;  while not dm.temp.eof do
      begin
        dbcmbox.items.add(dm.temp['值班医生']);
        dm.temp.next;
      end;
       dm.temp.first;
    end;
      

  5.   

    with ADOTable1 do
     begin
      while not eof do
        begin
         ComboBox1.Items.Add(ADOTable1.fieldbyname('字段').asstring);
         next;
        end;
     end;
    procedure Tdlfm.FormShow(Sender: TObject);
    begin  dm.temp.close ;
      dm.temp.commandtext:='select * from zhbysh ';
      dm.temp.open;  while not dm.temp.eof do
      begin
        dbcmbox.items.add(dm.temp['值班医生']);
        dm.temp.next;
      end;
       dm.temp.first;
    end;