//下拉列表

protected void Page_Load(object sender, EventArgs e)

    {

 

 

        SqlConnection myConnection = new SqlConnection("Data Source=.;Initial Catalog=H;User ID=sa");

        


        SqlDataAdapter
myCommand = new SqlDataAdapter("select * from D", myConnection);

        DataSet ds = new DataSet();

        myCommand.Fill(ds, "D");

        DropDownList7.DataSource = ds.Tables["D"].DefaultView;

        DropDownList7.DataTextField = "Dept";

        DropDownList7.DataValueField = "Dept";

        DropDownList7.DataBind();

 

 

}