linq中日期格式转换或者比较,程序报错说不支持方法的解决办法

时间:2022-03-25 13:57:54
public void TestMethod1()
{
using (var _context = new hotelEntities())
{
var rq = DateTime.Now.Date;
var query = from q in _context.UV_RZJL_RZRY_Single
where SqlFunctions.DateDiff("day",rq,q.LDRQ)>0
select q;
Assert.Inconclusive(query.Count().ToString()); 


}


可以用SqlFunctions,命名空间using System.Data.Objects.SqlClient;