日期:2014-05-20 浏览次数:21042 次
_priority=_priority==0?0:_priority; var qry=from c in ctxt.Tasks where 1=1 && c.priority==_priority select c;
------解决方案--------------------
var p= from c in ctxt.Tasks select c;
if (!string.IsNullOrEmpty(ddlpriority.SelectedValue))
p= p.Where(s => s._priority == ddlpriority.SelectedValue);
IQueryable<T> query = from c in ctxt.Tasks
where (c.priority == null || c.priority ==_priority )
select c;
------解决方案--------------------
IQueryable<Tasks> v = from t in Tasks select t; if (!string.IsNullOrEmpty(ddlpriority.SelectedValue)) { v.Where (p=>p.priority == ddlpriority.SelectedValue); }
------解决方案--------------------
C# code
IQueryable<Tasks> v = from t in Tasks
select t;
if (!string.IsNullOrEmpty(ddlpriority.SelectedValue))
{
v.Where (p=>p.priority == ddlpriority.SelectedValue);
}
------解决方案--------------------
d
------解决方案--------------------
提供表结构
测试信息
极其想要的结果
我帮你用sql写
------解决方案--------------------
也开始接触linq了,有很多都不会转
------解决方案--------------------