且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在C#2008中的选择表单下拉列表中的gridview中显示记录,第一条记录显示正常,当从ddl中选择其他名称时,第二条记录未显示,而是给出错误

更新时间:2022-01-05 04:53:49

其中 ITInfoID = + DropDownList1.SelectedValue +"
where ITInfoID =" + DropDownList1.SelectedValue + "", conn); ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); }


您需要另一个双引号字符:
You need another double quote character:
da = new SqlDataAdapter(select * from ITInfo


" span> + DropDownList1.SelectedValue +" ,conn) ;
where ITInfoID =" + DropDownList1.SelectedValue + "", conn);

成为

da = new SqlDataAdapter("select * from ITInfo