A powerful paging code.

Source: Internet
Author: User
The main code is setrowcount30select * from (selecttop30 * from (selecttop30 * fromtableorderbyidasc) zorderbyz. iddesc) zzorderbyidasc. You can extend it in any program. Find me the source code. The program is tested in asp. It has passed the test. Speed Paging

The main code is set rowcount 30 select * from (select top 30 * from (select top 30 * from table order by id asc) z order by z. id desc) zz order by id asc can be expanded in any program. Find me the source code. The program is tested in asp. It has passed the test. Speed Paging

Main Code
Set rowcount 30
Select * from (select top 30 * from (select top 30 * from table order by id asc) z order by z. id desc) zz order by id asc


Can be expanded in any program
Try it. Find me the source code.
The program is tested in asp. It has passed the test.
The speed of page turning is very fast.
AD: http://www.uutvs.com
<无>
'* Database to json paging public class library' * EMAIL: wyonli@gmail.com QQ: 82366788 $ '* $ Author: Cason $' * $ Id: yl_clsjson.asp 6481 2011-11-26 00:21:46 Cason $ property get order_name () dim o_ SQL, o_colum, olen, o_pai, idim left_ SQL, rows = bytes = instr (o_ SQL, "order") left_ SQL = left (o_ SQL, olen-1) right_ SQL = trim (mid (o_ SQL, olen) if olen = 0 thenresponse. write "Please set the sorting method! "Response. endend if o_ SQL = split (right_ SQL, "") for I = 0 to ubound (o_ SQL) if o_ SQL (I) = "by" then if I> 1 theno_ SQL (1) = "by" o_ SQL (I) = "" end if I> 2 and o_ SQL (2) = "" and o_ SQL (I) <> "" theno_ SQL (2) = o_ SQL (I) = "" end if o_ SQL (I) = "asc" or o_ SQL (I) = "desc" thenif I> 3 theno_ SQL (3) = o_ SQL (I) o_pai = "" & o_ SQL (I) = "" exit for end if nextright_ SQL = join (o_ SQL) if o_pai = "" theno_pai = "asc" right_ SQL = replace (right_ SQL, o_ SQL (2), o_ SQL (2) & "asc ") end if cason_ SQL = left_ SQL & right_sqlorder_name = o_ SQL (2) & o_incluend propertyproperty get th (ByVal str_val) if instr (str_val, "desc")> 0 thenth = replace (str_val, "desc", "asc") elseth = replace (str_val, "asc", "desc ") end if end property '========================================== = ========================================================== =================================== public Property Get ResultSet () dim Cason_Rs, col_namedim top_ SQL, top_Count, select_sqldim set_ SQL col_name = order_nameif int (partition) = 1 thentop_ SQL = "top" & partition & "" top_Count = "top" & (partition) * Cason_PageSize & "" top_Count = (Cason_CurrPage-1) * Cason_PageSize end if set_ SQL = "select" & top_ SQL & trim (mid (Cason_ SQL, 7 )) select_ SQL = "set rowcount" & Cason_PageSize & "; select * from (select top" & Cason_PageSize & "* from (" & set_ SQL & ") z order by" & th (col_name) & ") zz order by zz. "& col_name set Cason_Rs = yl. getRs (select_ SQL, 1, 1) if int (Cason_CurrPage)> Cason_Rs.pagecount thenCason_CurrPage = response = "," "iRecCount": "& num_rows &" response. write toJSON ("" info ", Cason_Rs) End Property

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.