tags:

views:

58

answers:

2

I am tring to compare a date from a asp calendar control to a date in the table.... here's what i have... it doesn't like the == ?

var query = from details in db.TD_TravelCalendar_Details
                    where details.StartDate == calStartDate.SelectedDate
                    && details.EndDate == calEndDate.SelectedDate
                    select details;
+1  A: 

In order for your query to work both details.StartDate and calStartDate.SelectedDate must be typed as System.DateTime.

What error are you receiving? Most likely one of these properties is a string and will need to be parsed into a DateTime instance for comparison.

Andrew Hare
A: 

What is the Type of details.StartDate and details.EndDate? Is it String? Maybe that's the problem. If the database type is String you should Parse the Date String into a DateTime and compare it with the calendar's selected date then.

bruno conde
The details.StartDate and EndDate are DateTime in the table...