adoq1.Close;
     adoq1.SQL.Clear;
     adoq1.SQL.Add('select * from zhongyang');
     adoq1.Open;
     if adoq1.RecordCount>0 then adoq1.Recordset.MoveFirst;
     for i:=1 to adoq1.RecordCount do
     begin
       
       combobox1.Items.Add(adoq1.Fields[1].value);
        adoq1.Recordset.MoveNext;
     end;
     adoq1.Close;上面的代码有问题吗?为什么在combobox1中添加的都是第一条记录的值呢?
请大家帮帮忙呀!!!!!小弟先感谢!!!!!

解决方案 »

  1.   

    adoq1.Recordset.MoveNext;改为 adoq1.Next;
      

  2.   

    with adoq1 do
    begin
    first;
    for i:=1 to adoq1.RecordCount do
    begin       
      combobox1.Items.Add(adoq1.Fields[1].value);
    end;
    next;  
    end;給分
      

  3.   

    begin
    combobox1.items.clean;
    with adoq1 do 
    SQL.Clear;
    SQL.Add('select distinct /*字段*/ from zhongyang');
    Open;
    if not eof then
       begin
        combobox1.items.add(adoqu1.fieldbyname('字段').asstring);
       end;
    next;
    end;
    end;    
      

  4.   

    adoq1.Recordset.MoveNext;=>adoq1.Next
      

  5.   

    我猜一下你以前有可能写过ASP:
    rs.open "select * from ------"
    rs.movefrist
    .
    .
    .
    .
    rs.movenext
    .
    .
    .
    aps中的ado和delphi中的ado是两个概念哈