在Linq查询中比较日期时间 [英] Compare Datetime in Linq Query

查看:209
本文介绍了在Linq查询中比较日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



请帮帮我

i想要比较我的 EndDate PresentDate linq 查询中,这里的问题是

EndDate在我的sql数据库中以String类型存储。 Datetime.parse 在lenq查询中不起作用。我试过 Datetime.parse

DateTime.ParseExact



i得到错误everttime



 LINQ to Entities无法识别方法'System.DateTime ParseExact(System.String,System.String,System.IFormatProvider)'方法,并且此方法无法转换为商店表达式。

解决方案

< blockquote>请参阅此链接,这可能会对您有所帮助。

http://stackoverflow.com/questions/7740693/big-issue-in-converting-string-to-datetime-using-linq-to-entities [ ^ ]


检查:

LINQ查询仅比较DateTime的日期部分 [ ^ ]

LINQ中的日期时间比较 [ ^ ]

Linq查询仅比较DateTime的Date部分 [ ^ ]


hi ,
please help me
i want to Compare my EndDate with PresentDate in linq query, here problem is
EndDate is stored as String type in my sql database. Datetime.parse is not working in lenq query. i tried with Datetime.parse
and DateTime.ParseExact

i got an error everttime

LINQ to Entities does not recognize the method 'System.DateTime ParseExact(System.String, System.String, System.IFormatProvider)' method, and this method cannot be translated into a store expression.

解决方案

Refer this link this might help you.
http://stackoverflow.com/questions/7740693/big-issue-in-converting-string-to-datetime-using-linq-to-entities[^]


Check:
LINQ query to compare only date part of DateTime[^]
DateTime Comparison in LINQ[^]
Linq Query to compare only Date part of DateTime[^]


这篇关于在Linq查询中比较日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆