标签:style class blog code tar color
/* 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; }
标签:style class blog code tar color
原文地址:http://www.cnblogs.com/bingxueme/p/3796373.html