我用的是SQL SERVER数据库,想将表中一个字段内的所有值填入ListBox。是用ListBox1.items.add()方法吗?是的话,应该要怎么写?谢谢

解决方案 »

  1.   

    adotable.first;
    while not adotable.eof do
    begin
    ListBox1.items.add(adotable['ziduan']);
    adotable.next;
    end
      

  2.   

    adotable.first;//定位第一条
    while not adotable.eof do
    begin
    ListBox1.items.add(adotable['ziduan']);//添加
    adotable.next;//移动到下一条
    end
      

  3.   

    adoquery1.first;
    while not adoquery1.eof do
    begin
      listbox1.items.add(adoquery1.fields[0].value);
      adoquery1.next;
    end;
      

  4.   

    哪我要怎么样指定一个表呢?ADOTable应该也要有个相关联的表吧~~~~
      

  5.   

    随便找本数据库的书看看
    ADO数据库联接
      

  6.   

    我倒~~~我现在一时找不到书,才来CSDN上问的,呵呵!!!!
      

  7.   

    >哪我要怎么样指定一个表呢?
    >ADOTable应该也要有个相关联的表吧~~~~我没看错吧,
    楼主你在吓我吧,
    没有书看就去看Delphi帮助中有关数据库的部份
      

  8.   

    我是 新手 ,仅供参考:
    用adodataset的command text取出你要显示的字段,
    然后编写如下:
    for i:=0 to adodataset1.fieldcount-1 do
      listbox1.items.add(adodataset1.fields.fields[i].fieldname);