entity framework - LINQ 2 Entities-query is not working, but why? -
entity framework - LINQ 2 Entities-query is not working, but why? -
everyone! )) here code.
var existingentities = (from record in globalone.servicecontext.records_out record.timestamp.date == datetime.now.date select record ).tolist();
it doesn't work.
another code:
var existingentities = (from record in globalone.servicecontext.records_out record.timestamp.day == datetime.now.day select record ).tolist();
it work.
so, problem id in next string:
where record.timestamp.**date** == datetime.now.date
also won't do
where record.timestamp.date.equals(datetime.now.date)
but why? have no clue. "timestamp" field datetime field in ms sql server. , - there no records in table.
and forgot - mean - "doesn't work". app not reach breakpoint after query(first), without error, without anything.
thanks.
you can phone call record.timestamp.date
because ef can't convert required look tree (then convert sql command). in fact ef supports limited number of functions , properties, datetime, ef has canonical functions. can utilize them in case, e.g can utilize day(),month(),year() functions solve problem (see link).
linq entity-framework datetime linq-to-entities
Comments
Post a Comment