for i:=0 to Query.recordCount-1 do
begin

解决方案 »

  1.   

    for i:=0 to Query.recordCount-1 do
    begin
         combobox1.items.add(Query.fieldByName('datetime').asstring);
         query.next
    end;
      

  2.   

    for i:=0 to Query.recordCount-1 do
    begin
    combobox.Items.Add();
    next ;
    end
      

  3.   

    这写了一个过程
    procedure additems_sql(targer_combobox:TCustomComboBox;sql_text:string);
    var
    adoqry_temp:tadoquery;
    begin
      adoqry_temp:=tadoquery.create(nil);
      adoqry_temp.Connection :=MainDataModule.adocntMain;
      adoqry_temp.close;
      adoqry_temp.SQL.Text:=sql_text;
      try
        adoqry_temp.open;
      except
        raise;
      end;
      adoqry_temp.first;
      targer_combobox.items.clear;
      while not  adoqry_temp.Eof do
        begin
          targer_combobox.Items.add(trim(adoqry_temp.Fields[0].asstring));
          adoqry_temp.Next ;
        end;
      adoqry_temp.free;
    end;
      

  4.   

    ComboBox.Items.Add(Query.Fields[0].AsString);
      

  5.   

    while not Query1.Eof do
    begin
      Combobox1.Items.add(Query.fieldByName('datetime').asstring);  
      Query1.next;
    end
      

  6.   

    with query do 
    begin
      close;
      sql.clear;
      sql.add(...);
      open;
      first;
      combobox.clear;
      while not (query.eof ) do 
      begin 
        combobox.items.add(fieldbyname(..).asstring);
        next;
      eind;
    end;
      

  7.   

    EdComboBox1.items.Add('your string');
      

  8.   

    var
      abc:string;
    while not query1.eof
    begin
    abc:=query1.fieldbyname('fff').asstring;
    Combobox1.additem(abc,combobox1);
    query1.next;
    end;