<%
''参数定义部分开始,建议放在文件开头
''=========分页参数==========
Dim Page,TurnPageName,LinkStr
Page = Request.QueryString("Page")
TurnPageName = "Admin_Article.Asp" '当前页面名称
LinkStr = ""
TurnPageCount = 15 ''每页显示的记录数
If Page = "" Or Not IsNumeric(Page) Then
Page = 1
End If
''===========================
''=======查询条件参数========
Dim Condition,KeyWord
Condition = ""
KeyWord = Request("KeyWord")
If KeyWord <> "" Then
Condition = Condition &" And [字段]='"& KeyWord &"'"
LinkStr = "&KeyWord="& KeyWord
End If
''===========================
''参数定义部分结束
''记录提取部分开始
SqlStr ="Select * From [Table] Where 1=1"& Condition &" Order By id Desc"
set Rs = Server.CreateObject("Adodb.Recordset")
Rs.Open SqlStr,Conn,1,1
AllNoteCount = Rs.Recordcount
If Not Rs.Eof Then
Rs.PageSize = TurnPageCount
AllPageCount = Rs.PageCount
If Page - AllPageCount > 0 Then
Page = AllPageCount
End If
If AllPageCount <> 0 Then
Rs.AbsolutePage = Page
End If
For Icount = 1 To TurnPageCount
If Rs.Eof Then Exit For
''列表循环部分开始
Response.Write("列表循环部分")
''列表循环部分结束
Rs.MoveNext
Next
Else
AllPageCount = 0
Page = 0
Response.Write("暂无相关信息")
End IF
Rs.Close()
Set Rs = Nothing
''记录提取部分结束
Call TurnPage() ''调用翻页函数
''函数主体:系统通用翻页模块,
Sub TurnPage()
Response.Write("共<B>"& AllNoteCount &"</B>条记录 ")
If Page > 1 Then
Response.Write("<a href='"& TurnPageName &"?Page=1"& LinkStr &"'>首页</a> <a href='"& TurnPageName &"?Page="& Page-1 & LinkStr &"'>上一页</a> ")
Else
Response.Write("<font class=""AbleFont"">首页 上一页 </font>")
End If
If Page - AllPageCount < 0 Then
Response.Write("<a href='"& TurnPageName &"?Page="& Page+1 & LinkStr &"'>下一页</a> <a href='"& TurnPageName &"?Page="& AllPageCount & LinkStr &"'>尾页</a> ")
Else
Response.Write("<font class=""AbleFont"">下一页 尾页 </font>")
End If
Response.Write("<B><font class=""KeyFont"">"& Page &"</font>/"& AllPageCount &"</B> ")
Response.Write("转到<select name=""gotopage"" onChange=""if (this.options[this.selectedIndex].value!=''){window.location=this.options[this.selectedIndex].value;}"" style=""font-size:12px; height:16px; border=0;"" valign=""middle"">")
For I = 1 To AllPageCount
If Page - I = 0 Then
Selected = " selected"
Else
Selected = ""
End If
Response.Write("<option value='"& TurnPageName &"?Page="& I & LinkStr &"' "& Selected &">第"& I &"页</Option>")
Next
If AllPageCount = 0 Then
Response.Write("<option value=''>第0页</Option>")
End If
Response.Write("</select>")
End Sub
%>