Oracle 分页
/* GetDataTable方法需要自己写,传入一个查询语句返回一个datatable */
/// <summary> /// 获取分页数据 /// </summary> /// <param name="PageIndex">页码</param> /// <param name="countPerPage">每页条数</param> /// <param name="columns">返回结果集的列名集合以逗号隔开</param> /// <param name="sqlstr">查询语句</param> /// <returns></returns> public DataTable GetPageData(int PageIndex, int countPerPage, string columns, string sqlstr) { DataTable dt = new DataTable(); //起始条数 int startRow = (PageIndex - 1) * countPerPage + 1; //结束条数 int endRow = PageIndex * countPerPage; string selectStr = "select " + columns + " from (select rownum rownumber ," + columns + " from (" + sqlstr + ") A ) B where rownumber between " + startRow + " and " + endRow; dt = GetDataTable(selectStr); return dt; }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。