C# 将TextBox读取的数据动态绑定到DropDownList的问题
protectedvoidDropDownList1_SelectedIndexChanged(objectsender,EventArgse){this.oraclec...
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
this.oraclecon = new OracleConnection(OracleconnectionString);
oraclecon.Open();
string strsql = "SELECT * FROM XDFRYXX WHERE DEPARTMENT = '" + TextBox1.Text + "'";
OracleDataAdapter da = new OracleDataAdapter(strsql, this.oraclecon);
da.Fill(ds);
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataTextField = "ID";
DropDownList1.DataValueField = "ID";
DropDownList1.DataBind();
oraclecon.Close();
}
这是我的代码,为什么dropdownlist不显示数据呢 展开
{
this.oraclecon = new OracleConnection(OracleconnectionString);
oraclecon.Open();
string strsql = "SELECT * FROM XDFRYXX WHERE DEPARTMENT = '" + TextBox1.Text + "'";
OracleDataAdapter da = new OracleDataAdapter(strsql, this.oraclecon);
da.Fill(ds);
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataTextField = "ID";
DropDownList1.DataValueField = "ID";
DropDownList1.DataBind();
oraclecon.Close();
}
这是我的代码,为什么dropdownlist不显示数据呢 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询