I am trying to enhance the Iqueryable Find method, very similar to:
public IQueryable<Dinner> FindUpcomingDinners()
{
return from dinner in db.Dinners
where dinner.EventDate > DateTime.Now
orderby dinner.EventDate
select dinner;
}
in NerdDinner.
In my GymAttendance, AttnRepository.cs (very similar to DinnerRepository.cs in NerdDinner), I am trying to query the database table on a selected date and the Time from/To, which I have as a float datatype.
Code:
public IQueryable<Attendance> FindAttendance(DateTime SelDate, float SelTimeFrom, float SelTimeTo)
{
return from attendance in db.Attendances
where attendance.GA_Date == SelDate && SelTimeFrom >= attendance.GA_Time_From && SelTimeTo <= attendance.GA_Time_To
orderby attendance.GA_Date, attendance.GA_Time_From
select attendance;
}
it gives me error:
Quote:
|
'>=' cannot be applied to operands of type 'float' and 'string'
|
on both
Quote:
|
SelTimeFrom >= attendance.GA_Time_From
|
and
Quote:
|
SelTimeTo <= attendance.GA_Time_To
|
Is this the right way to query multiple fields in a table? What could I do to query the time, which I store as float datatype?
Thanks in advance.
