如何在EF 3.5中编写

编程入门 行业动态 更新时间:2024-10-12 10:27:49
本文介绍了如何在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中编写

本文发布于:2023-11-13 22:56:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585550.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   EF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!