C# EF+Linq分页

int rows, int page

int nRecordStart = (page - 1) * rows;

数据库表名Customer。

var demo = (from u in dbContext.Customer

                        where u.Id > 0

                        orderby u.Id //默认升序ascending,降序descending

                        select u).Skip(nRecordStart ).Take(rows);  //越过10条取5条(等于每页5条,取第三页)

你可能感兴趣的:(linq)