Linq查询问题高手来
public int SpConverter(string str, DateTime? sPCutDate)
{
if (string.IsNullOrEmpty(str) || !sPCutDate.HasValue)
return 0;
if (str.Equals("True") || str.Equals("true"))
{
if (sPCutDate.HasValue)
{
if (sPCutDate.Value > DateTime.Now)
return 1;
}
}
return 0;
}
var result = from c in this.dbc.SecondHouse
select new
{
JiaJi=SpConverter(c.UrgentSale,c.SPCutDate)
}
return result;
前台能绑定也能显示
return result.Where(o=>o.JiaJi==1);
报错方法“Int32 SpConverter(System.String, System.Nullable`1[System.DateTime])”不支持转换为 SQL
求解