BennyHua

数据库分页查询

  1、SQLite数据库分页查询:

select * from users order by id limit 10 offset 0;//offset代表从第几条记录“之后“开始查询,limit表明查询多少条结果

运用: string sqlPage= string.Format("select * from users order by id limit {0} offset {1}",dp.PageSize, dp.PageSize * dp.PageIndex);

SQLite中没有Top关键字,仿Sql中的Top运用:排序后取前1000条数据

select * from users order by id desc limit 0,1000

2、ACCESS数据库分页查询:

string sqlPage = string.Format("select * from (select top {0} * from (select top {1} * from users ORDER BY id DESC) ORDER BY id ASC) ORDER BY id DESC",dp.PageSize, dp.PageSize*dp.PageIndex);

分类:

技术点:

相关文章:

  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-12
  • 2021-12-18
  • 2022-01-01
  • 2021-05-30
相关资源
相似解决方案