如何通过linq按顺序转换列
选择年份 来自我的桌子 Order By Cast( [Year] as Int ) Desc
我正在尝试在 linq order by 中做同样的事情。它不起作用。 我有在数据库中定义为字符串(Varchar)的列,在需要对其进行排序之前,我需要将其转换/转换为整数。我的 linq 语句应该是什么?
提前致谢。
Select Year
From MyTable
Order By Cast( [Year] as Int ) Desc
Same thing I am trying to do in the linq order by. It's not working.
I have column that is defined in the data base as string (Varchar) and I need to cast/convert it to integer before I need to sort it. What should be my linq statement?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
执行如下操作:
上述查询是从 中提取的在这里。
Do something like this:
The above query was extracted from here.