这里是文章模块栏目内容页
c#sqlite分页

//示例1: 使用SQLite数据库实现分页功能

string sql = "SELECT * FROM tableName ORDER BY id ASC LIMIT @pageSize OFFSET @offset";

using(SqliteConnection conn = new SqliteConnection("Data Source=data.db;Version=3;"))

{

using (SqliteCommand cmd = new SqliteCommand(sql, conn))

{

cmd.Parameters.AddWithValue("@pageSize", pageSize); // 每页的记录条数             cmd.Parameters.AddWithValue("@offset", pageIndex * pageSize); // 跳过多少行开始取值                                                  conn.Open();                      var reader = cmd.ExecuteReader();  while (reader.Read()) { ConsoleWrite($"ID:{reader["id"]} Name: {reader["name"]}"); } }                 }