如何讲数据表里的一个字段内容全写到ListBox里呀?

解决方案 »

  1.   

    table.first;
    while not table.eof do begin
    listbox.item.add(Trim(table.Filedbyname('字段名').asstring);
    table.next;
    end;
      

  2.   

    table.first;
    while not table.eof do begin
    listbox.item.add(Trim(table.Filedbyname('字段名').asstring);
    table.next;
    end;
      

  3.   

    循环去取一个数据表的字段然后加到listbox中就可以了啊
       Sqlstr:='Select AA,BB from tblName';
        DM.CloseQueryData(Query);
        Query.SQL.add(SqlStr);
        Try
           Query.Open();
        except
            dm.CloseQueryData(query);
            Application.MessageBox('加载单位信息失败.',pchar(Application.Title),MB_ICONINFORMATION);
            exit;
        end;
        if  Query.IsEmpty=true then
        begin
            Application.MessageBox('无可用的信息.',pchar(Application.Title),MB_ICONINFORMATION);
            exit;
        end
        else
        begin
            Query.First ;
            While not Query.eof  do
            begin
                listbox1.Items.add(Query['AA']) ;
                Query.Next ;
            end;
        end;
      

  4.   

    不是有数据库感知控件的么?干吗用listbox控件啊?
      

  5.   

    ADOQuery1.First ;
      while not ADOQuery1.Eof do
      begin
        ComboBox1.Items.Add(ADOQuery1.fieldByName('edit1').AsString);
        ADOQuery1.Next ;
      end;AdoTable和AdoQuery各有什么优缺点呢?
    说说吧,我很想听听大家的意见!
      

  6.   

    前面的都可以啊,哈哈
    adotable 和adoquery adotable对数据库表下的每一个记录和字段提供了直接访问
    adoquery是使用sql语句通过ado从一个物理数据库表中提取数据