/*************************************/
/*1、MY TOOL:*************************/
/*2、Delphi,Oracle,Sybase,C++/C*******/
/*3、PROJECT:*************************/
/*3、Boss*****************************/
/*4、为了五星的目标希望你早点结贴*********/
/*5、在线技术讨论(QQ):68123095*********/
/*************************************/

解决方案 »

  1.   

    呵呵,还以为是送分的,那知道....................
    /*************************************/
    /*1、MY TOOL:*************************/
    /*2、Delphi,Oracle,Sybase,C++/C*******/
    /*3、PROJECT:*************************/
    /*3、Boss*****************************/
    /*4、为了五星的目标希望你早点结贴*********/
    /*5、在线技术讨论(QQ):68123095*********/
    /*************************************/
      

  2.   

    把adotable直接挂上数据库就行了
    b:='select username from usertable;
    with adotable do
    begin
        close;
        sql.Clear;
        sql.Add(b);
        open;
        First;
        for i:=1 to adotable.RecordCount do
        begin
            commandbox1.items.Add(fieldbyname('username').asstring);
        next;
        end;
    end;
      

  3.   

    写对的 前面在加上 Commandbox1.items.Clear;
      

  4.   

    with adotable do
    begin
        close;
        sql.Clear;
        sql.Add('select username from usertable');
        open;
        First;
        while not eof do
        begin
            commandbox1.items.Add(fieldbyname('username').asstring);
        next;
        end;
    end;
      

  5.   

    呵呵 NEXT空4格就好看了。。
      

  6.   

    b:='select username from usertable';
    with adotable do
    begin
        close;
        sql.Clear;
        sql.Add(b);
        open;
        First;
        while not adotable.eof do    
        begin
            commandbox1.items.Add(fieldbyname('username').asstring);
        next;
        end;
    end;
    /*************************************/
    /*1、MY TOOL:*************************/
    /*2、Delphi,Oracle,Sybase,C++/C*******/
    /*3、PROJECT:*************************/
    /*3、Boss*****************************/
    /*4、为了五星的目标希望你早点结贴*********/
    /*5、在线技术讨论(QQ):68123095*********/
    /*************************************/
      

  7.   

    adotable1.active := true;
    if adotable1.recordcount > 0 then
    begin
      combobox1.items.clear;
      with adotable1 do
      begin
        first;
        while not eof do
        begin 
          commandbox1.items.Add(fieldbyname('username').asstring);
          next;
        end;
      end;
      
    end;
      

  8.   

    use one tquery 
    eg:
    with query1 do
    begin
      close;
      sql.text:='select username from userstable';
      open;
      first;
      combobox1.items.clear;
      for i:=1 to recordcount do
      begin
        combobox1.items.add(fields[0].asstring);
        next;
      end;
    end;
      

  9.   

    是啊 CSDN上不要脸的人比较多
      

  10.   

    只是相补充几句.
    1. ADOTable 是无 ADOTable1.sql 这个属性 
    2. 避免重覆的username, 你用的sql应为  
       select distinct username from usertable.
      

  11.   

    我来补充!千万记得在往里加之前,应加上
    combobox.items.clear;
      

  12.   

    b:=''select username from usertable;'
    with adotable do
    begin
        close;
        sql.Clear;
        sql.Add(b);
        open;
        First;
        for i:=1 to adotable.RecordCount do
        begin
            commandbox1.items.Add(fieldbyname('username').asstring);
        next;
        end;
    end;
      

  13.   

    用adotable不行,SQL应用ADOquery直接挂上数据库就行了
    b:='select username from usertable;
    with ADOquery do
    begin
        close;
        sql.text:=b; 
        open;
        First;
        for i:=1 to ADOquery.RecordCount do
        begin
            commandbox1.items.Add(fieldbyname('username').asstring);
            next;
        end;
    end;
      

  14.   

    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    ADOQuery1.SQL.Text := 'select distinct username from usertable';
    try
        ADOQuery1.Open;
    except
        ShowMessage('error occurs while opening db');
        Exit;
    end;ComboBox1.Clear;
    while not ADOQuery1.Eof do
    begin
        ComboBox1.Items.Add(ADOQuery1.FieldByName('username').AsString);
        ADOQuery1.Next;
    end;
    ADOQuery1.Close;呵呵~见笑了~
      

  15.   

    有一本<delphi实务经典>我就是看那边书起家的