Deficiency of > and Suggestions for Amendment

Source: Internet
Author: User
Tags count
The shortcomings of << improving the performance >> of dynamic Paging in ASP and suggestions for amendment

Oh, can enter the essence area? It took me a day.
Two brother Zhang << improve the performance of dynamic pagination in ASP >> I am very inspired by the article, but there are some deficiencies in my thinking.

One is unable to respond to some updates with the information.
Add now is a BBS, then the information updated at any time has
Click on each posting
New post information, these in the two Brother Brother's scheme can not be automatically updated, only users can change the query to use.

Second, the memory used too much, in fact, for a forum, most people still in order to visit, there is no need for everyone a session.

Third, the processing of data is not convenient
It can only be done in array mode, not intuitive, poor readability.


For the above points, I propose the following improvement plan
The use of application can be used to achieve multiple people using the same data
Two only save and retrieve ID number, other data make second select
Three automatically deletes obsolete application to save memory.
Iv. re-import data when adding and deleting data

Other benefits
Oh, you can use the GetString (), the original pagination does not
You can use 1, 3,

The code is as follows

A_page.asp
-----------------------------------------------------------------'
<%
Dim apage_pagesize ' Number of records per page
Dim apage_count ' Total Record count
Dim Apage_pagecount ' Total Pages
Dim apage_pageform ' Jump page with form
Dim apage_pageurl ' Previous Page next page link
Dim apage_timeout ' Expiration Time setting (seconds)

apage_timeout=300 ' Expiration Time set (SEC)
Apage_pagesize=20 '

function apage_bactive (str_name) ' To determine if there is this object and to delete expired objects
Apage_bactive=false
Dim Item, S_temp
For Item=1 to Application.contents.count ' Find out all application
S_temp=application.contents (item)
If IsArray (s_temp) Then
If UBound (s_temp) =3 and s_temp (0) = "Apage" Then
If S_temp (1) =str_name Then
Apage_bactive=true ' requires objects to exist
Else
If DateDiff ("s", S_temp (2), now ()) >apage_timeout then ' deletes its object
Application.contents.remove (item)
End If
End If
End If
End If
Next
End Function ' B_inuser

Sub Apage_open (Str_name, str_table, str_id, Str_sqlend) ' open object and compute some data
' object names, table names, keyword names, query criteria
Dim A1, A_ob
If not apage_bactive (str_name) Then ' a new object if the object does not exist
Apage_load Str_name, Str_table, str_id, Str_sqlend
End If
A1=application (Str_name)
A1 (2) =now ()
Application.Lock
Application (Str_name) =a1
Application.UnLock
A_OB=A1 (3)
Apage_count=ubound (a_ob,2) +1
Apage_pagecount=int (apage_count/apage_pagesize) +1
End Sub ' Apage_open

function Apage_get (str_name, page) ' Gets all ID numbers on this page
Dim a1, A_ob, I_stat, I_end, I1, Str_actionurl, Str_query, str_1, str_2
' The following is to ensure that page is correct
Page=cint (page)
If page <1 then page=1 &AMP;NB



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.