SQLite分页查询的SQL语句:

 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         }
View Code

 

 

posted on 2018-05-11 15:07  逛园子$$$  阅读(250)  评论(0编辑  收藏  举报