Pagination | statement | Source code This paging code is simple to use, with only 4 steps:
(1) Constructing SQL query statements, setting database connection strings, and setting the number of records displayed per page
(2) Insert the paging control code <b>navigator_init.inc</b> file
(3) in the appropriate place on the page (that is, where you want to display "top page, Next page"), insert the pager code <b>navigator.inc</b>
(4) Display the record of this page by looping
< a > ASP files that require paging
Sample.asp
<%
' Get the full path of the current ASP page, the important skill
Thescript = Request.ServerVariables ("Script_name")
' (1) Constructing SQL statements
Myconnstr = "Driver={sql server};server=yourserver;uid=sa;pwd=;d atabase=yourdatabase"
Thepagesize = 20 ' number of records displayed per page
Usql = "SELECT * FROM Yourtablename"
' (2) inserting paging control code
%>
<!--#include file= ". /inc/control/navigator_init.inc "-->
<title>test</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link rel= "stylesheet" href= ". /default.css "type=" Text/css ">
<!--your HTML code//-->
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
<td>
<!--(3) Insert pager code-->
<!--#include file= ". /inc/control/navigator.inc "-->
</td>
</tr>
</table>
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
<td>
<!--(4) Display this page with a circular record-->
<% for i = 1 to rs.pagesize%>
<!--your records display code//-->
<%
Rs. MoveNext
If Rs. EOF Then
Exit for
Rs.close
Conn.close
End If
Next
%>
</td>
</tr>
</table>
</body>
< two > Paging control code:
Navigator_init.inc
<%
Thecurrentpagenum = CLng (Request ("PN")