实现下拉列表的动态绑定(简单的)
代码页中:
public partial class link1 : System.Web.UI.Page
{
 
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection myConnection = new SqlConnection(
         "Data Source=XIAOHUA;Initial Catalog=ok;User ID=sa");
        SqlDataAdapter myCommand = new SqlDataAdapter("select * from info", myConnection);

 

        DataSet ds = new DataSet();
        myCommand.Fill(ds, "info");

        DropDownList3.DataSource = ds.Tables["info"].DefaultView;
        DropDownList3.DataTextField = "id";
        DropDownList3.DataValueField = "id";
        DropDownList3.DataBind();


    }
}