假设你的部门表为dep,以下程序即可:
private void Page_Load(Object Src, EventArgs E) {
    SqlConnection mycon=new  SqlConnection("server=yourserver;uid=sa;
pwd=;database=databsae");
         SqlDataAdapter myad=new SqlDataAdapter("select Dep_id,Dep_name from dep",mycon);
         DataSet mds=new DataSet();
         myad.Fill(mds,"dep");
         ListBox1.DataSource=mds.Tables["dep"].DefaultView;   
         ListBox1.DataTextField=mds.Tables["dep"].Columns["Dep_name"].ToString();
         ListBox1.DataValueField=mds.Tables["dep"].Columns["Dep_id"].ToString();
         ListBox1.DataBind();
}部门:<asp:DropDownList  id="ListBox1" runat="server"/>

解决方案 »

  1.   

    用DropDownList控件
    SqlConnection mycon=new SqlConnection("Server;uid=;pwd=;database=");
    SqlDataAdapter myad1=new SqlDataAdapter("select groupid,groupname from SysGroups order by groupid asc",mycon);
    DataSet mds=new DataSet();
    myad1.Fill(mds,"Sysgroups");
    DropDownList1.DataSource=mds.Tables["Sysgroups"].DefaultView;
    DropDownList1.DataTextField=mds.Tables["Sysgroups"].Columns["groupname"].ToString();
    DropDownList1.DataValueField=mds.Tables["Sysgroups"].Columns["groupid"].ToString();
    DropDownList1.DataBind();
    mycon.Close();
      

  2.   

    DropDownList 怎么把到使用到DataGrid里呢
      

  3.   

    DropDownList 怎么把它使用到DataGrid里呢
      

  4.   

    <asp:TemplateColumn HeaderText="header">
         <ItemTemplate>
             <asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="False" />
         </ItemTemplate>
    </asp:TemplateColumn>