A slightly different paging component written by myself, namely a three-page paging component cached

Source: Internet
Author: User

A while ago. net enterprise-level training. When talking about the optimization of paging components, the teacher gave a three-page cache policy, so that the previous page does not need to be connected to the database, for the moment, I will not comment on the advantages and disadvantages of this method. First, let's take a look at the effect.

The definition of the object class is not mentioned. The difference may be that I set three objects, prepage, curpage, and nextpage, in the Oracle database, you only need to pay attention to rownum usage for SQL statements. I copy the SQL statements in reverse order ):

Select *

From (select rownum DD, F .*

From (select *

From Table1

Where id =: ID

And date> =: startdate

And date <: enddate

Order by date DESC) f

Where rownum <=: nextindex)

Where DD> lastindex

: The nextindex variable is the next index on the user-requested page: The lastindex variable is the previous index on the user-requested page. For example, if you want to view the data on the fourth page, nextindex = 50, lastindex = 20.

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.