已经在form1中手动配置和连接好了MDB数据库,在form1中有个Listbox1控件,有个按钮,点击按钮,把Acces的记录读出来,放入到Listbox1,请问怎么搞?

解决方案 »

  1.   

    供参考:
     
       with adoquery1 do begin
          close;sql.clear;
          sql.add('select distinct F01 from aTableName order by F01');
          open;
          while not eof do begin
              listbox1.items.add(fieldByName('F01').asstring);
              next;      
          end;
       end;
      

  2.   


    我就改一下1楼兄弟的吧,对新手有点用吧。begin
      ListBox1.Clear;
      with ADOQuery1 do begin
        SQL.Text := 'select distinct F01 from aTableName order by F01';
        Open;
        while not Eof do begin
          ListBox1.Items.Add(FieldByName('F01').AsString);
          Next;
        end;
        Close;
      end;
    end;
      

  3.   

    begin 
      ListBox1.Clear; 
      with ADOQuery1 do begin 
        SQL.Text := 'select distinct F01 from aTableName order by F01'; 
        Open; 
        while not Eof do begin 
          ListBox1.Items.Add(FieldByName('F01').AsString); 
          Next; 
        end; 
        Close; 
      end; 
    end;支持楼上的,一般都是这么处理的。比较明了。