DATEDIFF in linq (in months)

entity-framework linq linq-to-entities

Question

select col1,col2,col3 from table1 
where(DATEDIFF(mm, tblAccount.[State Change Date], GETDATE()) <= 4

This SQL query needs to be converted to LINQ. nevertheless, I am not aware of a DateDiff replacement in LINQ. Please give me some suggestions.

1
12
6/29/2012 10:27:47 AM

Popular Answer

You are trying to find SqlMethods.DateDiffMonth.

EDIT: Use SqlFunctions.DateDiff in EF4.

13
4/1/2011 5:50:08 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow