SoFunction
Updated on 2025-04-14

Query page turn optimization


<SCRIPT language="JavaScript">
    function doPage(n){
=+'?page='+n+'&Other conditions...';
    }
</SCRIPT>

<%
    Dim oDbPager
    iPageSize = DefaultPageSize
    Set oDbPager = New cc_db_Pager
    Set  = oConn
     = "t_Company"
     = "ID,Company,WebSite,MainProduct,UserLevel, Status, Phone, Fax"
     = "ID"
= "UserLevel DESC, Status DESC, CharIndex('China', Country) DESC, ID DESC"
     = iPageSize
     "Status>0"
    If Not isEmpty(("Auth1")) Then
         "Auth1>0"
    End If
     = ("page")
    iCurrPage = 
    iRecCount = 
    iPageCount = 
sPageInfo = "The current page is "&iCurrPage&" total "&iPageCount&" pages total "&iRecCount&" information"
    sPager  = "" &  vbCrLf _
"[<A "&IIif(CInt(iCurrPage)<=1,"disabled href='javascript:void(0);'","href='javascript:doPage(1);'")&">Home</A>]" & vbCrLf _
"[<A "&IIif(CInt(iCurrPage)<=1,"disabled href='javascript:void(0);'","href='javascript:doPage("&(iCurrPage-1)&");'")&">Previous page</A>]" & vbCrLf _
"[<A "&IIif(CInt(iCurrPage)>=CInt(iPageCount),"disabled href='javascript:void(0);'","href='javascript:doPage("&(iCurrPage+1)&");'")&">Last Page</A>]" & vbCrLf _
"[<A "&IIif(CInt(iCurrPage)>=CInt(iPageCount),"disabled href='javascript:void(0);'","href='javascript:doPage("&iPageCount&");'")&">Last Page</A>]"
%>
...
<%
    Set oRs = 
    Do While Not 
        '// ...
        ()
    Loop
%>
...
<%=sPageInfo%>
...
<%=sPager%>