/// <summary> /// 数据分页查询 /// </summary> /// <param name="pager"></param> /// <param name="sp"></param> /// <returns></returns> public IDataReader ExecPageReader(DBPagerInfo pager, params IDataParameter[] sp) { string sql = "SELECT COUNT(*) FROM (" + pager.Query + ")c"; pager.RecordCount = (int)Helper.ExecGetObject(sql, sp); sql = String.Format(@"WITH PAGED AS ( SELECT ROW_NUMBER() OVER(ORDER BY {0}) AS rowNum, * FROM ({1})a) SELECT TT.* FROM PAGED P INNER JOIN ({1})TT ON P.{2} = TT.{2} WHERE ROWNUM BETWEEN {3} AND {4} ORDER BY {0}", pager.OrderBy, pager.Query, pager.KeyId, pager.StartIndex + 1, pager.StartIndex + pager.PageSize); return(Helper.ExecReader(sql, sp)); }
/// <summary> /// /// </summary> /// <param name="pager"></param> /// <param name="sp"></param> /// <returns></returns> public IDataReader ExecPageReader(DBPagerInfo pager, params IDataParameter[] sp) { throw new NotImplementedException(); }
/// <summary> /// 执行分页查询 /// </summary> /// <param name="pager">分页对象</param> /// <param name="ps">可选参数数组</param> /// <returns></returns> public virtual IDataReader ExecPageReader(DBPagerInfo pager, params IDataParameter[] ps) { return(DBComm.ExecPageReader(pager, ps)); }