怎么在打开一个新的Form的时候让Form上的ComboBox里面的下拉内容自动读取数据库中某表的一列指定值?

解决方案 »

  1.   

    在新的FORM中放一个Table...指定你要读的表。在FORM的OnCreate事件中加入
    with table1 do
    begin
      First;
      while not Eof do
      begin
        ComboBox.items.add(FieldByName('Field1').AsString);
        Next;
      end;
      Close;
    end;
      

  2.   

    自己读了写进去吧ComboBox.items.add(Dataset.FieldByName('Field').AsString);
      

  3.   

    按hch_45(んこん) 的方法做了。不过要加上一句
    ComboBox.items.clear;
      

  4.   

    ComboBox.items.clear;  
    这句加哪里呢?
      

  5.   

    ComboBox.items.clear;
    with table1 do
    begin
      First;
      while not Eof do
      begin
        ComboBox.items.add(FieldByName('Field1').AsString);
        Next;
      end;
      Close;
    end;