SQLite分页查询的SQL语句:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 /// <summary> 2 /// 分页获取数据列表 3 /// </summary> 4 public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int count) 5 { 6 //select * from BirdDetectRecord order by 7 // DetectTime 8 //limit 9 //10 10 //offset 11 //1 12 StringBuilder strSql = new StringBuilder(); 13 strSql.Append("SELECT * FROM BirdDetectRecord order by "); 14 if (!string.IsNullOrEmpty(orderby.Trim())) 15 { 16 strSql.Append(orderby); 17 } 18 strSql.Append(string.Format(" limit {0} offset {1} ",count,startIndex)); 19 if (!string.IsNullOrEmpty(strWhere.Trim())) 20 { 21 strSql.Append(" WHERE " + strWhere); 22 } 23 return DbHelperSQLite.Query(strSql.ToString()); 24 }