asp.net中的dropdownlist绑定数据库怎么绑定不上?
我代码是这么写的新手求帮助protectedvoiddp2_SelectedIndexChanged(objectsender,EventArgse){DropDownL...
我代码是这么写的 新手 求帮助
protected void dp2_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList pdp2 = GridView1.FooterRow.FindControl("dp2") as DropDownList;
OracleConnection conn = new OracleConnection(oracleconstr);
OracleCommand cmd = conn.CreateCommand();
conn.Open();
cmd.CommandText = "select * from \"productclassdown\"";
OracleDataAdapter adapter = new OracleDataAdapter(cmd);
DataTable dt = new DataTable();
adapter.Fill(dt);
cmd.Dispose();
conn.Dispose();
pdp2.DataSource = dt;
pdp2.DataTextField = "D";
pdp2.DataValueField = "D";
pdp2.DataBind();
} 展开
protected void dp2_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList pdp2 = GridView1.FooterRow.FindControl("dp2") as DropDownList;
OracleConnection conn = new OracleConnection(oracleconstr);
OracleCommand cmd = conn.CreateCommand();
conn.Open();
cmd.CommandText = "select * from \"productclassdown\"";
OracleDataAdapter adapter = new OracleDataAdapter(cmd);
DataTable dt = new DataTable();
adapter.Fill(dt);
cmd.Dispose();
conn.Dispose();
pdp2.DataSource = dt;
pdp2.DataTextField = "D";
pdp2.DataValueField = "D";
pdp2.DataBind();
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询