Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DbArithmeticExpression arguments must have a numeric common type.
canberraTimetable = (from r in db.ShuttleTimeTables
                                                 where r.TimeTypeId == 5 && (DateTime.Today.Date + r.Time ) >= (DateTime.Today.Date + time_15)
                                                 select r.Time).ToList()
                                            .Select(x => new SelectListItem()
                                            {
                                                Text = x.Value.ToString(@"hh\:mm"),
                                                Value = x.Value.ToString(@"hh\:mm")
                                            }).Take(3).ToList();


if I don't have DateTime.Today.Date add to the r.Time then won't have problems.
But it when the time_15 = 23:59, then will select the 8:00 available to the user, I don't won't this. So I add DateTime.Today.Date to it only arrow compare at the same day.
Posted
Updated 6-Nov-14 13:04pm
v2
Comments
DamithSL 6-Nov-14 22:21pm    
what is the type of time_15 and r.Time?

1 solution

C#
canberraTimetable = db.ShuttleTimeTables.Where(r=>r.TimeTypeId == 5).ToList()
.Where(r=>(DateTime.Today.Date + r.Time ) >= (DateTime.Today.Date + time_15))
.Select(x=  new SelectListItem()
            {
                Text = x.Time.Value.ToString(@"hh\:mm"),
                Value = x.Time.Value.ToString(@"hh\:mm")
            }).Take(3).ToList();
 
Share this answer
 
Comments
SandyZhang2014 7-Nov-14 0:40am    
Thanks DamithSL :)
DamithSL 7-Nov-14 0:51am    
You are welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900