Cool General page Display control (i) Basic prototype
Source: Internet
Author: User
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) Inserting paging control code navigator_init.inc file
(3) in the appropriate place of the page (that is, you want to display "top page, next page" place), insert the pager code NAVIGATOR.INC
(4) Display the record of this page by looping
Suppose our Site directory structure is as follows:
asp/' ASP file path
images/' graphics file path
inc/' include file path
content/' store files that need to be included in every page, such as Header.inc, Footer.inc, etc.
control/' holds files such as navigator.inc, Query.inc equal to paging control
Additional suggestions:
Copy the contents of this page to EditPlus 2.1, and then read (as you'll see in future articles), and you'll find it easy to read because it's a very comfortable color configuration. Of course I highly recommend that you also use EditPlus 2.1来 to edit. htm,. asp,. inc files.
< 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")
Myconnstr = "Driver={sql server};server=yourserver;uid=sa;pwd=;d atabase=mytest"
Thepagesize = 20 ' number of records displayed per page
' (1) Constructing SQL statements
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 ">
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