我尝试按如下方式执行SQLDataSource.FilterExpression:
SqlDataSource view = new SqlDataSource(){ID = "view"};
this.Page.Controls.Add(view);
view.ConnectionString = ConnectionBDD.BDD;
view.SelectCommand = tempReq;
if (dpl_typTdb.SelectedValue != "Tout")
{
view.FilterExpression = "c.typTdb LIKE '{0}'";
view.FilterParameters.Add(new ControlParameter("typTdb", "dpl_typTdb", "SelectedValue"));
}
DataView dv = (DataView)view.Select(DataSourceSelectArguments.Empty);
if(dv.Count < 1)
{
//some code...
}
我的var tempReq看起来像这样:
SELECT *
FROM Cnd c
LEFT JOIN typCndAct a
ON c.TpCndAct = a.TpCndAct
LEFT JOIN typCndPrr p
ON c.TpCndPrr = p.TpCndPrr
ORDER BY c.MdfLe DESC
然后,我得到了一个像它一样的抛出异常:
&#34;找不到列[c.typTdb]。&#34;
我确定这个专栏在我的表格中,
提前感谢您的帮助。