TimeSpan time24 = new TimeSpan(24, 0, 0);
TimeSpan time18 = new TimeSpan(18, 0, 0);
// first get today's sleeping hours
List<Model.Sleep> sleeps = context.Sleeps.Where(
o => (clientDateTime - o.ClientDateTimeStamp < time24) &&
o.ClientDateTimeStamp.TimeOfDay > time18 &&
clientDateTime.TimeOfDay < time18 &&
o.UserID == userid).ToList();
这LINQ表达式抛出此异常:DbArithmeticExpression参数必须有一个数字常见的类型
DbArithmeticExpression arguments must have a numeric common type.
请帮助!
'clientDateTime - o.ClientDateTimeStamp'的结果是什么? – shahkalpesh 2012-03-22 10:30:37
noramlly应该是TimeSpan的一个对象,在EF异常中抛出。 – 2012-03-22 10:58:58