如何使用 lambda 创建"between"条件



我现在有一些参数的搜索代码,我想在数字之间插入(检查exchangeNoexchangeNo2MinutesNo),数据库中的MinutesNo是字符串字段exchangeNo & exchangeNo2这是我的代码:

where stationsID.Contains(station.ID) &&
((exchangeNo == null || exchaminut.MinutesNo.CompareTo(exchangeNo)>=0) &&
(exchangeNo2 == null || exchaminut.MinutesNo.CompareTo(exchangeNo2)<0))&&...

这不能正常工作。我必须做什么?

问题是数据库中字符串无法比较的字段类型,我将其更改为bigint并工作

最新更新