简体   繁体   English

NHibernate.Linq和CompareTo String

[英]NHibernate.Linq And CompareTo String

I'm using Linq and Hibernate and trying to compare to Strings one from a variable and the other from a Class Linked to Hibernate, the code: 我正在使用Linq和Hibernate,并尝试从一个变量和另一个从链接到Hibernate的类比较Strings,代码:

   bindingSource.DataSource = (from search in Repository.GetAll()
                               where search.cod_coluna.CompareTo(CurrentRecord.cod_coluna) > 0
                               orderby search.cod_coluna select search).Take(1);

And i get an Exception in Runtime, QueryException: Cannot use subqueries on a criteria without a projection. 我在运行时得到一个异常,QueryException:无法在没有投影的条件下使用子查询。

What i do now? 我现在应该做什么?

I think the problem is that CompareTo isn't something that can be mapped to SQL. 我认为问题是CompareTo不是可以映射到SQL的东西。

What type is cod_coluna? cod_coluna是什么类型的? You may be able to use == or != if you don't really need CompareTo. 如果你真的不需要CompareTo,你可以使用==或!=。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM