各位大侠,请教如下问题:
我想将SQL 数据库中 ASPABB 这张表中的ABB002这列的内容添加到DropDownList 控件中:请问如何复值string  strcon=ConfigurationSettings.AppSettings ["sqlconn"];       SqlConnection conn = new SqlConnection(strcon );
       conn.Open();     SqlCommand comm = new SqlCommand( "select ABB001,ABB002 from ASPABB"
 ,conn );//===================数据库表查询==========
      
      SqlDataAdapter SDA = new SqlDataAdapter();
      SDA.SelectCommand = comm;      DataSet DS = new DataSet();
      SDA.Fill(DS);DropDownList1.datasource=?DropDownList1.dataBin();

解决方案 »

  1.   

    不知道表达清楚了没哟,也就是将 SqlCommand comm = new SqlCommand( "select ABB001,ABB002 from ASPABB",conn ) 中查询的ABB002字段内容添加到DropDownList1中就可以了.
      

  2.   

    DropDownList1.DataSource = DS;
    DropDownList1.DataBind();
    DropDownList1.DisplayMember = "ABBOO1";  //显示内容所在的字段
    DropDownList1.ValueMember = "ABBOO2";    //值所在的字段
      

  3.   

    .droplist1.datasourse=ds.table["AB002"]
      

  4.   

    谢谢,找到方法了:  DripDownList.DataValueField = "ABB002";
      DripDownList.DataSource = ds;
      DripDownList.DataBind();
      

  5.   

    droplist1.datasourse=ds.tableS["AB002"]这个实现不了,添加不上内容;
    DropDownList1.DataSource = DS;
    DropDownList1.DataBind();
    DropDownList1.DisplayMember = "ABBOO1"; //显示内容所在的字段
    DropDownList1.ValueMember = "ABBOO2"; //值所在的字段没找到DisplayMember, ValueMember这两个属性;
      

  6.   

    DropDownList1.DataTextField="ABB001";
    DropDownList1.DataValueField = "ABB002";
    DropDownList1.DataSource = ds;
    DropDownList1.DataBind();
      

  7.   

    SqlCommand comm = new SqlCommand( "select ABB001,ABB002 from ASPABB",conn ) 中查询的ABB002字段内容添加到数组ArrayList如何解决?.
      

  8.   

    取数据到了dataset中,然后循环去读吧。用arraylist.add的方法