Using DateDiff with Linq.Dynamic library for fetching today records

后端 未结 6 996
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 16:23

I am trying to fetch all records added today using DateDiff SQL syntax via Linq expression in MVC 5 / Entity Framework 6 application. DateDiff function throw runtime error

6条回答
  •  悲哀的现实
    2020-12-10 16:54

    Your code is never executed in the database, the "issue" is that Linq.Dynamic tries to parse it as C# code, where it fails. As far as I know it is not possible to call SQL with dynamic linq.

    I believe you are looking for is using raw SQL, not .NET code which Linq.Dynamic is, this page at MSDN will give you more information about using raw SQL.

提交回复
热议问题