我想在MVC項目篩選與兩個下拉模型動態凡在LINQ MVC
var model = (from x in db.TABLE....
join y in db.TABLE...).Where(where)...
我的邏輯是
String where = string.Empty;
if (search.anno != null)
where = " ANNO = " + search.anno ;
if (search.Cliente != null)
{
if (!string.IsNullOrEmpty(where))
{
where += " And CODICE_CLIENTE = '" + search.Cliente + "'"; }
else
{
where = " CODICE_CLIENTE = '" + search.Cliente + "'";
}
}
我得到一個錯誤:System.Linq.Dynamic。 ParseException:字符文字必須只包含一個字符
我在那裏+ =「和CODICE_CLIENTE ='」+ search.Cliente +「'」;
我看到的Apex在到底是「」
如何解決
你得到,如果錯誤search.anno不爲null? –
是的!我看到在調試ANNO = 2015和CODICE_CLIENTE ='00106'「,我得到那個錯誤 – jon
如果只有Anno過濾控制器工作...但客戶過濾器不起作用 – jon