数据库中一张表中有个ti的字段,我想将ti 的内容动态的一一加入combobox中???

解决方案 »

  1.   

    var
      adoQ: TADOQuery;
    begin
      adoQ := TADOQuery.Create(nil);
      try
        with adoQ do
        begin
          Close;
          Connection := '';//自己配置
          sql.text := 'select distinct ti from 表名';
          Open;
          first;
          ComboBox1.Items.Clear;
          while not adoQ.eof do
          begin
            ComboBox1.Items.add(FieldByName('ti').AsString);
            next;
          end;
        end;
      finally
        FreeAndNil(adoQ);
      end;
    end;