我放了一个DropDownList1控件,想跟数据库里的一列绑定,请问下面程序怎么实现不了??public void DropDownList1Bind() //绑定博友列表
{ string sqlstr = "select friend from Friend where Uname = '" + Session["Uname"].ToString() + "'";
SqlDataAdapter da = new SqlDataAdapter(sqlstr, cn);
DataSet ds = new DataSet();
da.Fill(ds, "Friend");
this.DropDownList1.DataSource = ds.Tables["Friend"];
this.DropDownList1.DataBind();
cn.Close(); }
{ string sqlstr = "select friend from Friend where Uname = '" + Session["Uname"].ToString() + "'";
SqlDataAdapter da = new SqlDataAdapter(sqlstr, cn);
DataSet ds = new DataSet();
da.Fill(ds, "Friend");
this.DropDownList1.DataSource = ds.Tables["Friend"];
this.DropDownList1.DataBind();
cn.Close(); }
DropDownList1.DataTextField = "NAME";
DropDownList1.DataValueField = "ID";
DropDownList1.DataBind();
DropDownList1.DataTextField = "friend";
DropDownList1.DataValueField = "friend";
DataTextField
DataValueField