asp.net(c#)用dropdownlist有条件查询
asp.net(c#)想用dropdownlist的值作为select的条件运行时出现错误:CS0117:“System.Web.UI.WebControls.DropD...
asp.net(c#) 想用dropdownlist的值作为select的条件 运行时出现错误: CS0117: “System.Web.UI.WebControls.DropDownList”并不包含“SelectItem”的定义
代码
void Page_Load(object sender, EventArgs e)
{
DropDownList1.Items.Insert(0,"Please select ptice");
DropDownList1.Items.Insert(1,"<80");
DropDownList1.Items.Insert(2,"80-90");
DropDownList1.Items.Insert(3,"90-100");
}
void Button1_Click(object sender, EventArgs e) {
string sql,strconnection;
strconnection = "Provider=Microsoft.Jet.OLEDB.4.0;"+"Data Source="+Server.MapPath("booking.mdb");
OleDbConnection conn= new OleDbConnection(strconnection);
conn.Open();
string dropvalue=DropDownList1.SelectItem.Value;
sql="select name from standard where price='"+dropvalue+"'";
} 展开
代码
void Page_Load(object sender, EventArgs e)
{
DropDownList1.Items.Insert(0,"Please select ptice");
DropDownList1.Items.Insert(1,"<80");
DropDownList1.Items.Insert(2,"80-90");
DropDownList1.Items.Insert(3,"90-100");
}
void Button1_Click(object sender, EventArgs e) {
string sql,strconnection;
strconnection = "Provider=Microsoft.Jet.OLEDB.4.0;"+"Data Source="+Server.MapPath("booking.mdb");
OleDbConnection conn= new OleDbConnection(strconnection);
conn.Open();
string dropvalue=DropDownList1.SelectItem.Value;
sql="select name from standard where price='"+dropvalue+"'";
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询