我在一个form中加入table、datasource和dbcombobox1并把它们连接一起了但在运行中dbcombobox1只显示表当前的记录而其他记录不能显示在下拉框中
因该怎样解决这个问题?

解决方案 »

  1.   

    with ADOQuery1do
      begin
          close;
          commandtext:='select  xlmc from cam_cp_name';
          open;
          first;
        while not eof do
        begin
          for i:=1 to recordcount do
            begin
              dbcombobox1.items.add(trim(fieldbyname('xlmc').asstring));
              next;
            end;
        end;
    end;
      

  2.   

    不好意思,改正如下:
    with ADOQuery1 do
      begin
          close;
          commandtext:='select  字段名 from table';
          open;
          first;
        while not eof do
        begin
              dbcombobox1.items.add(trim(fieldbyname('字段名').asstring));
              next;
        end;
        
    end;