tags:

views:

434

answers:

3

I am ran into the following issue.

Take a look at the following where clause.

Where(x => x.CreateTS <= dateParameters.CreationDate.ToDateValue &&
           x.CreateTS >= dateParameters.CreationDate.FromDateValue)

CreateTS is a Timestamp column in the table. so when my dateparameters are todate = 01/28/2010 12:00A.M" fromdate= "01/26/2010 12.00A.M" (c# DateTime types) my query doesnot retrivies the table records whose CreateTS look like 01/28/2010 1:45A.M and above just differeing in the timestamps.

I just wanted to do comparison and dont want to compare the timestamps. any help would be appreciated.

+2  A: 
Reed Copsey
When I compare using the date portion I dont get any results and I am gettign the following error messageThe specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.Any comments?
SARAVAN
You didn't specify Entity Framework, so I was just using standard LINQ to Objects. See my revision for another option.
Reed Copsey
Sorry my question was not clear earlier. But when I use AddDaysT am gettign the following error message The specified type member 'AddDays()' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported
SARAVAN
Reed Copsey
A: 

Interesting moment here is that 01/28/2010 12:00A.M actually in 24 hour format is 00:00 while 01/28/2010 1:45A.M is 01:45 and that seems to be the reason why those records are not returned. The midday will be 01/28/2010 12:00P.M

dh