Oracle分页查询
作者:互联网
/// <summary> /// 分页查询 /// </summary> /// <param name="sql"></param> /// <param name="orderby"></param> /// <param name="startIndex"></param> /// <param name="endIndex"></param> /// <returns></returns> /// <remarks> /// add by harris.zhang 2016-3-5 /// </remarks> public static DataTable GetListByPage(string sql, string orderby, int startIndex, int endIndex) { if (orderby.Trim() == "") { orderby = "0"; } StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM ( "); strSql.Append(" SELECT ROW_NUMBER() OVER ("); strSql.Append("order by " + orderby); strSql.Append(")AS Rowidx, ZZZZZ.* from (" + sql + ") ZZZZZ "); strSql.Append(" ) XXXXX"); strSql.AppendFormat(" WHERE XXXXX.Rowidx > {0} and XXXXX.Rowidx <= {1}", startIndex, endIndex); return MES.DBUtility.DbHelperOra.Query(strSql.ToString()).Tables[0]; }
标签:orderby,分页,Rowidx,int,查询,strSql,Oracle,XXXXX,Append 来源: https://www.cnblogs.com/qq2806933146xiaobai/p/15826058.html