Sac*_*nth 5 c# linq linq-to-entities entity-framework-4.1
我有以下代码
DateTime now = DateTime.UtcNow;
var allItemsOver64 = _inventoryContext.Items.Where(i =>
(SqlFunctions.DateDiff("dd", i.PrimaryInsured.DoB, now) / 365.0) >= 65);
IQueryable<Item> items65To69 = allItemsOver64.Where(i =>
(SqlFunctions.DateDiff("dd", i.PrimaryInsured.DoB, now) / 365.0) >= 65 &&
(SqlFunctions.DateDiff("dd", i.PrimaryInsured.DoB, now) / 365.0) <= 69);
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用allItemsOver64因此Items65To69.Count()时,我得到了这个错误
表达式((((转换(DateDiff("dd",[10007] .PrimaryInsured.DoB,26/04/2012 15:03:09))/ 365)> = 65)和((转换(DateDiff("dd) ",[10007] .PrimaryInsured.DoB,26/04/2012 15:03:09))/ 365)> = 65))和((转换(DateDiff("dd",[10007] .PrimaryInsured.DoB,26/04/2012 15:03:09))/ 365)<= 69))不受支持.
我究竟做错了什么?