【发布时间】:2019-12-11 14:28:57
【问题描述】:
从 DateTime 列中获取值 如果为 null 则返回 String.Empty 别的 DateTime.ToShortDateString
我在做什么错 => 查询产生如下:
var queryable = from p in Products
select new {
selldate = p.SellEndDate == null
? string.Empty
: p.SellEndDate.Value.ToShortDateString() };
错误:InvalidOperationException:无法翻译表达式'Table(Product).Select(p => new f__AnonymousType01(selldate = IIF((p.SellEndDate = null), Invoke(value(System.Func1[System.String])),p.SellEndDate.Value.ToShortDateString()))) ' 到 SQL 中,无法将其视为本地表达式。
【问题讨论】:
标签: linq