private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string text=DropDownList1.SelectedItem.Text;
OleDbConnection con=new OleDbConnection();
con.ConnectionString="Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=pubs;User ID=sa;password=123";
con.Open();
string sql2="select * from employee where job_id=(select job_id from jobs where job_desc='"+text+"')";
OleDbCommand cd=new OleDbCommand(sql2,cn);
OleDbDataReader rrd=cd.ExecuteReader();
Repeater1.DataSource=rrd;
Repeater1.DataBind();
con.Close();
}
为什么程序运行时..改变下拉框的值时Repeater1里绑定的内容不变呢?而放在Form_Load里就可以?