Direct code
/// <summary> ///paging through SQL/// </summary> /// <param name= "SQL" ></param> /// <returns></returns> Public Static stringGetpaginationsql (stringSQL) { intIntpagesize =int. Parse (httpcontext.current.request["rows"] ==NULL?"0": httpcontext.current.request["rows"]. ToString ()); intIntcurrentpage =int. Parse (httpcontext.current.request["page"] ==NULL?"0": httpcontext.current.request["page"]. ToString ()); stringSort = httpcontext.current.request["Sort"]; stringOrder = httpcontext.current.request["Order"]; intStartRow = (Intcurrentpage-1) * Intpagesize +1; intEndrow = StartRow-1+intpagesize; StringBuilder SB=NewStringBuilder (); Sb. Append ("SELECT * FROM ("); Sb. Append ("SELECT a.*, ROWNUM RN from ("); Sb. AppendFormat ("{0}", SQL); Sb. Append (string. IsNullOrEmpty (sort)?"":string. Format ("order BY {0} {1}", sort, order)); Sb. AppendFormat (") A WHERE ROWNUM <={0}", Endrow); Sb. AppendFormat (") WHERE RN >={0}", StartRow); returnsb. ToString (); }
Paging SQL (Oracle Edition)