Reputation: 7299
i want to execute this query in EF 4.5:
db.UPTO_CarReceiption.Where(u => (DateTime.Now - u.RegisterDate).TotalMinutes <= 30).Select(i => i.TechnicalReviewCenterId)
But i get this error :
DbArithmeticExpression arguments must have a numeric common type.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: DbArithmeticExpression arguments must have a numeric common type.
Upvotes: 0
Views: 918
Reputation: 7299
Just do this :
ViewBag.OnlineATE = db.UPTO_CarReceiption.Where(u => EntityFunctions.DiffMinutes(u.RegisterDate,DateTime.Now)<30).Select(i => i.TechnicalReviewCenterId).Distinct().Count();
Upvotes: 1