简体   繁体   English

排序Nullable Biginit返回错误的排序数据

[英]Sorting a Nullable Biginit is returning wrong sorted data

I have a column inside my sql server 2008 R2 of type Biginit that allow nulls named “Serial”. 我的SQL Server 2008 R2中有一列Biginit类型的列,该列允许名为“ Serial”的空值。 It has values such as :-:- 它具有诸如:-:-的值

**Serial**
100200
100202
100375
100376
100377

Now inside my asp.net mvc web application, I have the following linq query inside the entity framework :- 现在在我的asp.net mvc Web应用程序内部,我在实体框架内有以下linq查询:-

var records = repository.AllFind(withOutSpace).OrderBy(a => a.Technology.Serial).ToPagedList(page, pagesize);

so I am ordering the the records ascending based on the Serial number , but the result was that I got the following order 所以我要根据序列号对记录进行升序排序,但是结果是我得到了以下顺序

100375
100376
100377
100200
100202

So it assumed that 100200 is grater than 100377 !!, any idea what might be causing this issue ? 因此,它假定100200比100377 !!更好,你知道是什么引起了这个问题吗? Thanks 谢谢

If it is taking 100200 as bigger than 100377 then, he is sorting lexicographically, like if the elements were string. 如果100200比100377大,那么他按字典顺序排序,就像元素是字符串一样。

Lexicographycally, 100200 is greater than 100377, and maybe this is the reason. Lexicographycally,100200大于100377,也许这就是原因。

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

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