⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.asp

📁 带5000条数据的数据库实列! 支持多参数! 支持数字(前十页后十页)和文字导航切换! 代码编写规范!
💻 ASP
字号:
<%
'================================================
'/印象分页类(Impression_Page v1.0)
'/作者:纯属.印象(QQ:442398600、Email:jhy0029@qq.com
'================================================
Dim Database_ConnStr, Database_Path
Dim DB_Conn, DB_Sql, DB_RS
Database_Path = "db.mdb"
Nowstring = "Now()"
Database_ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath(Database_Path)
On Error Resume Next
Set DB_Conn = Server.CreateObject("Adodb.Connection")
DB_Conn.Open Database_ConnStr
			
If Err.Number <> 0 Then
	Err.Clear
	DB_Conn.Close
	Set DB_Conn = Nothing
			
	Response.Write "数据库链接出错!"
	Response.End
End If
%>
<!--#include file="page_class.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>分页程序</title>
<style type="text/css">
<!--
a { text-decoration: none;} /* 链接无下划线,有为underline */ 
a:link { color: #000000;} /* 未访问的链接 */
a:visited { color: #000000;} /* 已访问的链接 */
a:hover{ color: #FF0000;} /* 鼠标在链接上 */ 
a:active { color: #FF0000;} /* 点击激活链接 */
body,td {
	font-size: 12px;
	color: #000000;
	text-decoration: none;
}
-->
</style>
</head>
<body>
<%
Dim RS, Sql
Sql = "select ID,NameTitle from PageTable "
Sql = Sql & "order by ID asc"

Dim Obj_CreatePage
Set Obj_CreatePage = New Impression_Page
'/*得到数据连接对象*/
Obj_CreatePage.GetConn = DB_Conn
'/*得到Sql查询语句*/
Obj_CreatePage.GetSQL = Sql
'/*设置每页显示条数*/
Obj_CreatePage.PageSize = 20
'/*分页导航(1为有数字,2为无数字)*/
Obj_CreatePage.Page_NavType = 2
'/*分页的文件地址,可提前构造好,支持多参数传递!*/
Obj_CreatePage.File_Path = "default.asp"

Set RS = Obj_CreatePage.GetRs()
%>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#666666">
<%
If Not(RS.Bof and RS.Eof) Then
For I = 1 to Obj_CreatePage.PageSize
If RS.Eof Then
	Exit For
End If
%>
  <tr>
    <td width="10%" bgcolor="#FFFFFF" align="center"><%=RS("ID")%></td>
    <td bgcolor="#FFFFFF" style="padding:5px;"><%=RS("NameTitle")%></td>
  </tr>
<%
RS.MoveNext
Next
%>
  <tr>
    <td align="center" colspan="2" bgcolor="#FFFFFF" style="padding:5px;"><% Obj_CreatePage.Page_Navigation() %></td>
  </tr>
<%
Set Obj_CreatePage = Nothing
Else
	Response.Write "<tr>"
	Response.Write "<td colspan='2' height='100' bgcolor='#FFFFFF'>"
	Response.Write "<div align='center'>暂无任何数据!</div>"
	Response.Write "</td>"
	Response.Write "</tr>"
End If
RS.Close
Set RS = Nothing
DB_Conn.Close
Set DB_Conn = Nothing
%>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -