Pagination | functions | show <%
Option Explicit
Response.Buffer = True
On Error Resume Next
Dim Startime,endtime,sql_use,conn,db,connstr
Rem ##########################################################################
Rem # Description: The database used in this example is the Dynamic network forum IP Database # #
Rem # If you do not want to replace can be found in the Dynamic Network forum. ##
Rem # If you want to change the database, then you must modify the corresponding SQL statements and other parameters # #
Rem # released in this document I will be JS attached to the following, and removed the CSS, and so on, you can add it! ##
Rem ##########################################################################
Startime = Timer ()
' First use please modify the local database address and modify the database name in the data directory accordingly
' Db = ' Database/ixuer_data_pams1.mdb '
Db = "/database/ipaddress.mdb"
ConnStr = "Provider = Microsoft.jet.oledb.4.0;data Source =" & Server.MapPath (DB)
Set Conn = Server.CreateObject ("ADODB. Connection ")
Conn.Open ConnStr
If ERR Then
Err.Clear
Set Conn = Nothing
Response.Write "The database connection error, please check the connection character string."
' Response.Write ' Database connection error, please check the connection string. "
Response.End
End If
Function Closedb ()
Conn.close
Set Conn = Nothing
End Function
'=========================================================
' File: Ixuer_data_pageshow
' Function: page-reading of specified items in specified database
' Time: 2004-08-29
' Author: guidy
' Copyright: Ixuer Studio
'=========================================================
' Copyright (C) 2004-2006 114XP. CN All rights reserved.
' Official website: HTTP://www.114xp.cn
' Technology Forum: HTTP://bbs.114xp.cn
' Email: guidy@qq.com,guidy@psysch.com
'=========================================================
Dim Sqlstr,datenums,pagenums,urls
SQLSTR = "SELECT * FROM Dv_address"
Conn = Conn
Datenums = 20
Pagenums = Request ("Page")
URLs = ""
'################################################################################
' You need to define these three functions prior to use, depending on your application
'################################################################################
Function Ixuer_page_dhead ()
Response.Write ("End Function
'--------------------------------------------------------------------------------
Function Ixuer_page_dbody (DPS_RS)
Response.Write ("Data:" & Dps_rs ("IP1") & "---" & dps_rs ("IP2") & "---" & dps_rs ("Country") & "---" & Amp Dps_rs ("City") & "<br>")
End Function
'--------------------------------------------------------------------------------
Function Ixuer_page_dtail ()
Response.Write ("End Function
'################################################################################
Call Ixuer_data_pageshow (Sqlstr,conn,datenums,pagenums,urls)
'################################################################################
Function Ixuer_data_pageshow (Sqlstr,conn,datenums,pagenums,urls)
'=========================================================
' Function: Ixuer_data_pageshow (sqlstr,conn,datenums,pagenums,urls)
' Function: page-reading of specified items in specified database
' Parameters: SQL statements, database linked objects, number of pages per page, page numbers, linking URLs
' Return: string
' Time: 2004-08-29
' Author: guidy
' Copyright: Ixuer Studio
'=========================================================
' Copyright (C) 2004-2006 114XP. CN all Rights Reserved.
' Official website: http://www.114xp.cn
' Technology Forum: http://bbs.114xp.cn
' Email: guidy@qq.com,guidy@psysch.com
'=========================================================
Dim Dps_rs,dps_conn
Dim SQL
Dim Page
Dim dps_i
' Create a Recordset object
Set dps_rs = Server.CreateObject ("Adodb.recordset")
' Initialize SQL statement
SQL = Sqlstr
Dps_conn = Conn
' Execute SQL
Dps_rs.open sql,dps_conn,1,3
' Initialize page size--Number of display per page
Dps_rs.pagesize = Datenums
' Initialize page numbers
Page = CLNG (pagenums)
' If the page number is less than 1, or if no page number is selected, force the first page
If IsNull (page) Or page = "" Then page = 1
If page <= 1 then page = 1
' Force to the last page if the page number is greater than the maximum value
If Page>=dps_rs.pagecount Then Page=dps_rs.pagecount
' If the page number is not equal to 1, jump to the specified page to read the data
If Page <> 1 Then
If (Page-1) * Dps_rs.pagesize < Dps_rs.recordcount Then
Dps_rs.move (Page-1) * dps_rs.pagesize
End If
End If
Call Ixuer_page_urls (Page,urls,dps_rs, "DPS_TP1", "Page")
' Data display table header
Call Ixuer_page_dhead ()
dps_i = 0
Do, not dps_rs.eof and Dps_i < dps_rs.pagesize
' Data display body part
Call Ixuer_page_dbody (D