本文介绍了如何在EF 3.5中编写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在EF 3.5查询中编写以下条件.下面是SQL格式.
How to write below condition in EF 3.5 Query. Below in SQL format.
a.member in ('Free','PartTime') and (DATEDIFF(m,asofdate,getdate())>0 or AsOfDate is null)推荐答案
您正在使用的LINQ.使用DateTime.Now获取当前日期,然后从那里进行比较.您知道如何编写LINQ查询吗? It''s LINQ you are using. use DateTime.Now to get the current date, and then compare it from there. Do you know how to write LINQ queries ?
看看 www.linqpad / [^ ] LINQPad允许您使用linq交互式地查询数据库-这是用于尝试查询的有用工具. 我也很确定我会使用 ExecuteStoreQuery [ ^ ],只需使用您的SQL执行查询即可. 我希望您知道您的查询将转换回SQL,因为SQL Server尚未了解linq. 最好的问候 Espen Harlinn Have a look at www.linqpad/[^] LINQPad lets you interactively query databases using linq - it''s a useful tool for trying out queries. I''m also pretty certain that I would use ExecuteStoreQuery[^] and just execute the query using your SQL. I expect that you know that your query will be translated back to SQL because SQL server hasn''t got a clue about linq. Best regards Espen Harlinn
更多推荐
如何在EF 3.5中编写
发布评论