var i:integer;adoquery1.Close;
 adoquery1.SQL.Clear;
 adoquery1.SQL.Add('select cno from course.db');
 adoquery1.Open;
 adoquery1.Edit;
 for i=0 to i=adoquery1.RecordCount-1 do
   listbox3.items.add(adoquery1. … (i));我想用adoquery找出数据库里的某列的数据,然后在这列中以列的序列依次将数据输到listbox的items中,就是不知道怎么表示adoquery里列的每个数据,
为了能用循环,需要可以用i表示。请高手指教!

解决方案 »

  1.   


    //var i:integer; adoquery1.Close; 
    adoquery1.SQL.Clear; 
    adoquery1.SQL.Add('select cno from course.db'); 
    adoquery1.Open; 
    if not Adoquery1.isEmpty then 
    begin
      adoquery1.first;
      if Assigned(Adoquery1.findField('列名')) then 
      begin
        with Adoquery1 do while not eof do 
        begin
          listbox3.items.add(fieldbyname('列名').asstring);
          next;
        end;
      end;
    end;  
      

  2.   

    非常感谢!可以了。如果可以的话还请你解说下下面四句话的意思,本人才刚接触delphi 想多了解下,多谢了啊!!!
    adoquery1.first
    Assigned(Adoquery1.findField('列名')) 
    eof
    with Adoquery1 do while not eof do 
      

  3.   

    第一句將數據集移動數據集的頭第二句判斷有沒有這具字段名的字段EOF  是判斷是不是到了數據集的尾最後是一個 While 循環. 滾動數據集的