【发布时间】:2013-05-15 07:39:08
【问题描述】:
我的 Sql 查询是:
select count(*),CONVERT(varchar, AddedOn, 101)
from MemberNotifications where IsActive=1
group by CONVERT(varchar, AddedOn, 101)
order by CONVERT(varchar, AddedOn, 101) desc
但我无法得到结果,在下面的尝试中
List<NotificationCounts> lst =
(from mn in this.MemberNotifications
where mn.UId.Equals(friendId)
select new NotificationCounts{ NotificationDate = mn.AddedOn.ToString("mm/dd/yyyy") })
.ToList<NotificationCounts>();
我只想获取 mat 字符串中的日期列表,但它给出了一个例外
LINQ to Entities 无法识别方法 'System.String ToString(System.String)' 方法,而且这个方法不能翻译 到商店表达式中。
这个错误有什么解决办法吗?
【问题讨论】:
-
NotificationDate在NotificationCounts类中的类型是什么