1、
con.Open();
SqlCommand cmd = new SqlCommand("select sno from s", con);
SqlDataReader dr = cmd.ExecuteReader();
this.DropDownList1.DataSource = dr;
this.DropDownList1.DataTextField = "sname";
this.DropDownList1.DataValueField = "sname";
this.DropDownList1.DataBind();
dr.Close();
string s = this.DropDownList1.Text;
为dropdownlist绑定数据源,用 s 获取其选定的值,选择了但每次获取的总是第一个?
2、sqldatasource配置数据源是VS弹出:
这个好像是有关的系统服务关闭了,但我把相关的服务都开了还是不行,是不VS的问题啊?