相关疑难解决方法(0)

Linq-to-Entities:选择查询表达式中的格式日期

我试图直接从LINQ到实体查询表达式获取格式化的日期字符串.

nonBusinessDays = (from ac in db.AdminCalendar
                   where ac.DateTimeValue >= calendarStartDate && ac.DateTimeValue <= calendarEndDate && ac.IsBusinessDay == false
                   select ac.MonthValue + "/" + ac.DayOfMonth + "/" + ac.FullYear).ToList();
Run Code Online (Sandbox Code Playgroud)

但是,我得到了folloinw错误消息:"无法将类型'System.Nullable`1'强制转换为'System.Object'.LINQ to Entities仅支持转换实体数据模型基元类型."

除了遍历结果集之外,还有什么方法可以做到这一点吗?谢谢!安倍晋三

datetime linq-to-entities string-formatting

5
推荐指数
1
解决办法
2万
查看次数