在Linq中大于等于 [英] More than or equal in Linq

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

问题描述

LinQ代码中的

如何对像这样的字符串字段应用比操作数更多的内容:

in LinQ code

How to apply more than operand for string fields like this:

db.table.where(c=>c.txtFromDate>"2000/12/05")

推荐答案

尝试一下

Try this

DateTime date1 = new DateTime(c.txtFromDate);
DateTime date2 = new DateTime("2000/12/05");
db.table.where(c=>DateTime.Compare(date1, date2)>0);



希望这有助于



Hope this helps


使用Date属性和> =运算符执行.重写的代码是:

Perform with Date attribute and >= operator. Rewritten code is:

db.table.where(c=>c.txtFromDate.Date >= Convert.ToDateTime("2000/12/05"))


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

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