sqlServer通用分页
1 /// <summary> 2 /// 分页获取数据列表 3 /// </summary> 4 public DataSet GetList(int PageSize, int PageIndex, string strWhere) 5 { 6 StringBuilder strSql = new StringBuilder(); 7 strSql.Append("select count(userId) as AllRows from USERS where " + strWhere + " "); 8 strSql.Append("SELECT * FROM ( "); 9 strSql.Append("SELECT ROW_NUMBER() OVER(ORDER BY createTime) as ROWID, userId, userType, personId, account, password, isAdmin, enabled, loginIP, loginTime, loginTimes, lastLoginIP, lastLoginTime, remark, state, createUser, createTime, updateUser, updateTime FROM USERS "); 10 strSql.Append(" WHERE " + strWhere); 11 strSql.Append(") AS TMP_GAME "); 12 strSql.Append(" WHERE ROWID > " + (PageSize * (PageIndex - 1))); 13 strSql.Append(" AND ROWID <= " + (PageSize * (PageIndex - 1) + PageSize)); 14 return new DbHelperSQL().ExecuteQuery(strSql.ToString());
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步