我想把数据库表中的一个字段所用不同的内容通过另一个窗体COMBOBOX下拉表中体现出来,我用的table控件。

解决方案 »

  1.   

    procedure TForm1.FormCreate(Sender: TObject);
    var
      Str: String;
    begin
      with Table1 do
      begin
        Fisrt;
        while not eof do
        begin
          Str := FieldByName(FieldName).AsString;
          if ComboBox1.Items.IndexOf(Str) = -1 then
            ComboBox1.Items.Add(Str);
          Next;
        end;
      end;end;
      

  2.   

    var
      s:string;
      I:Integer;
    begin
      with Table1 do
      for I:=0 to RecordCount-1 do
      begin
        s:=Table1['Name'];
        comboBox1.Items.Add(s);
        Table1.Next;
      end;
    end;
      

  3.   

    楼上( chutian(我很丑???) )的已经解决了
      

  4.   

    table 的cloumn edit中cloumn的picklist中可以设置下拉列表,他是一个tstring类型
      

  5.   

    不要用Table
    用query
       
      query.close;
      query.sql.text:='select distinct FieldName from table ' 
      try
      query.open;
      except
      end;
      query.first
      while not query.eof do 
      begin
      ComboBox1.Items.Add(query.fieldbyname('fieldbyname').asstring);
      query.next;
      end;
      要给我分啊!