Orderby() not ordering numbers correctly c#

后端 未结 12 1720
渐次进展
渐次进展 2020-12-15 03:08

I am writing an app for my company and am currently working on the search functionality. When a user searches for an item, I want to display the highest version (which is st

12条回答
  •  旧巷少年郎
    2020-12-15 03:37

    If you're unable to change your table definition (so the version is a numeric type), and your query really is as listed (your not using skip, or take, or otherwise reducing the number of results), the best you can do is call "ToList" on the unsorted results, which when you then apply an OrderBY lambda to it will take place in your code, rather than trying to do it at the SQL Server end (and which should now work).

提交回复
热议问题