标签:
/// <summary> /// 根据页数分页 /// </summary> /// <param name="page"></param> /// <param name="pagesize"></param> /// <param name="where"></param> /// <param name="column"></param> /// <returns></returns> public static DataSet GetListByPage(int page, int pagesize, string where, string column) { System.Text.StringBuilder sbu5 = new StringBuilder(); int num1 = (page - 1) * pagesize; int num2 = page * pagesize; sbu5.Append("select " + column); sbu5.Append(" FROM("); sbu5.Append("SELECT A.*, ROWNUM RN FROM (SELECT * FROM tabel WHERE 1=1" + where + ") A WHERE 1=1" + where + " AND ROWNUM <= " + num2); sbu5.Append(")"); sbu5.Append("where RN >" + num1); return DbHelperOra.Query(sbu5.ToString()); } /// <summary> /// 获得数据列表 /// </summary> /// <param name="strWhere"></param> /// <param name="column"></param> /// <returns></returns> public static DataSet GetList(string strWhere, string column) { StringBuilder strSql = new StringBuilder(); strSql.Append("select " + column); strSql.Append(" FROM table"); if (strWhere.Trim() != "") { strSql.Append(" where 1=1 " + strWhere); } return DbHelperOra.Query(strSql.ToString()); }
标签:
原文地址:http://www.cnblogs.com/myblogslh/p/4200958.html