SqlConnection cn = new SqlConnection();
cn.ConnectionString = "server=.;uid=sa;pwd=;datbase=book;";
cn.Open();
string sql = "select * from ptable";
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
da.Fill(ds);
this.DropDownList1.DataSource = ds;
this.DropDownList1.DataTextField = "pid";
this.DropDownList1.DataValueField = "pname";
this.DropDownList1.DataBind();
本人初学求指点