本文介绍了实体框架字符串使用大于运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使此查询像在sql中一样工作?在sql中,我可以在字符串上使用<
和>
运算符.
How do I make this query work like it does in sql? In sql I can use <
and >
operators on strings.
我已经搜索了大约20分钟,但还没有找到解决方法.
I've been googling this for about 20 minutes and have found no solution yet.
我无法将r.ExemptionCode转换为整数,因为它的值可能类似于'91A,9AA,ZZZ,Z01'
I cannot convert r.ExemptionCode to an integer as it may have values like '91A,9AA,ZZZ,Z01'
from r in results
where (r.ExemptionCode > "900" || r.ExemptionCode == "701" || r.ExemptionCode == "702" || r.ExemptionCode == "721" || r.ExemptionCode == "724")
select r
推荐答案
尝试一下:
from r in results
where (r.ExemptionCode.CompareTo("900") > 0 || r.ExemptionCode == "701" || r.ExemptionCode == "702" || r.ExemptionCode == "721" || r.ExemptionCode == "724")
select r
这篇关于实体框架字符串使用大于运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!