小编Sri*_*nth的帖子

如何将使用ROW_NUMBER()的查询转换为linq?

我的表由三列组成(sno,name,age).我正在使用额外的列(行号)从数据库中检索此表,并使用以下代码:

select * from (
    select ROW_NUMBER() over (order by SNo asc)as rowindex,SNo,Name,Age 
    from tblExample) 
    as example where rowindex between ((pageindex*10)+1) and ((pageindex+1)*10)
Run Code Online (Sandbox Code Playgroud)

注意,pageindex是一个变量,它接受用户传递的一些整数值.

我的数据库是Sql Server 2008.我想使用Linq编写相同的查询.我怎么做?

c# linq

10
推荐指数
2
解决办法
1万
查看次数

标签 统计

c# ×1

linq ×1