/* 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; }

 

posted on 2014-06-19 13:42  絕對零℃  阅读(166)  评论(0编辑  收藏  举报