ASP automatic paging code

Source: Internet
Author: User

<% @ Language = "VBScript" %>
<% Dim DSA
If SESSION ("mm_username") = "" then
Response. Redirect "index. asp"
End if
%>
<! -- # Include file = "fang. asp" -->
<! -- # Include file = "conn. asp" -->
<HTML>
<Head>
<Title> HengSheng training agent system </title>
<Meta HTTP-EQUIV = "Content-Type" content = "text/html; charset = gb2312">
<Style type = "text/CSS">
<! --
. Unnamed1 {
Border: thin groove #666666;
}
Body, TD, Th {
Font-size: 12px;
}
. Style1 {color: # ff0000}
-->
</Style>
</Head>
<Body bgcolor = # ffffff leftmargin = 0 topmargin = 0 marginwidth = 0 marginheight = 0>
<! -- Imageready slices (untitled-1) -->
<Div align = "center">
<Table width = "778" Height = "86" border = "0" cellpadding = "0" cellspacing = "0">
<Tr>
<TD Height = "21" colspan = "3"> </TD>
</Tr>
<Tr>
<TD width = "20" rowspan = "2"> </TD>
<TD width = "354" Height = "52"> </TD>
<TD width = "404" rowspan = "2"> </TD>
</Tr>
<Tr>
<TD Height = "13"> </TD>
</Tr>
</Table>
<Table width = "778" border = "0" class = "unnamed1">
<Tr>
<TD width = "155" Scope = "col"> <Div align = "center"> <a href = "admin_ry.asp"> personnel management </a> </div> </TD>
<TD width = "155" Scope = "col"> <Div align = "center"> <a href = "admin_kq.asp"> User order management </a> </div> </TD>
<TD width = "175" Scope = "col"> <Div align = "center"> <a href = "admin_yj.asp"> order management </a> </div> </TD>
<TD width = "155" Scope = "col"> <Div align = "center"> <a href = "admin_wt.asp"> Withdrawal Management </a> </div> </TD>
<TD width = "155" Scope = "col"> <Div align = "center"> <a href = "<% = mm_logout %>"> exit the system </a> </div> </TD>
</Tr>
</Table>
<! -- End imageready slices -->
<P> & nbsp; </P>
<%
Dim I, intpage, page, pre, last, filepath
Set rs = server. Createobject ("ADODB. recordset ")
SQL = "select * From wt order by ID DESC"
Rs. pagesize = 10' set the number of records displayed on each page
Rs. cursorlocation = 3
Rs. Open SQL, Conn, 1 'Run the SQL query and obtain the result record set.
Pre = true
Last = true
Page = trim (request. querystring ("page "))

If Len (PAGE) = 0 then
Intpage = 1
Pre = false
Else
If CINT (PAGE) = <1 then
Intpage = 1
Pre = false
Else
If CINT (PAGE)> = Rs. pagecount then
Intpage = Rs. pagecount
Last = false
Else
Intpage = CINT (page)
End if
End if
End if
If not Rs. EOF then
Rs. absolutepage = intpage
End if
%>
<%
For I = 1 to Rs. pagesize
If Rs. EOF or Rs. bof then exit
%>
<Table width = "778" border = "0" cellspacing = "0" cellpadding = "0">
<Tr>
<TD width = "194" align = "center"> <% = RS ("BT") %> </TD>
<TD width = "194" align = "center"> <% = RS ("Nr") %> </TD>
<TD width = "194" align = "center"> <% = RS ("idata") %> </TD>
<TD width = "199" align = "center"> <% = RS ("FYR") %> </TD>
</Tr>
</Table>

<%
Rs. movenext
Next
%>
Loop body ends
Paging part:
<Table width = "778" border = "1" cellpadding = "2" cellspacing = "2" bordercolorlight = #808080 bordercolordark = # ffffff>
<Tr>
<% If Rs. pagecount> 0 then %>
<TD width = "13%" align = "Left"> current page <% = intpage %>/<% = Rs. pagecount %> </TD>
<% Else %>
<TD width = "41%" align = "Left"> current page 0/0 </TD> <% end if %>
<TD width = "778" align = "right"> <a href = "admin_wt.asp? Page = 1 "> homepage </a> |
<% If pre then %>
<A href = "admin_wt.asp? Page = <% = intpage-1%> "> previous page </a> | <% end if %>
<% If last then %>
<A href = "admin_wt.asp? Page = <% = intpage + 1%> "> next page </a> | <% end if %>
<A href = "admin_wt.asp? Page = <% = Rs. pagecount %> "> last page </a> | go
<Select name = "sel_page" onchange = "javascript: Location = This. Options [This. selectedindex]. value;">
<%
For I = 1 to Rs. pagecount
If I = intpage then %>
<Option value = "admin_wt.asp? Page = <% = I %> "selected> <% = I %> </option>
<% Else %>
<Option value = "admin_wt.asp? Page = <% = I %> "> <% = I %> </option>
<%
End if
Next
%>
</SELECT> page </font>
</TD>
</Tr>
</Table>
</Div>
</Body>
</Html>

Related Article

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.