求带查询条件的分页显示程序

first_boy 2006-08-26 10:28:58
我用"超级ASP大分页"源代码已分得页,但是该代码没有 <<页面跳转>> 功能,我改里面程序又不懂,因为涉及到类,那个做带查询条件的分页显示程序的请帮忙!

最好是源代码的,因为我菜..
...全文
260 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
badmeat 2006-10-08
  • 打赏
  • 举报
回复
谢谢,一不小心被我借用啊
liumang9527 2006-10-07
  • 打赏
  • 举报
回复
'=============公共翻页模块=================================
Sub TurnPage(ByRef Rs_tmp,PageSize,Incl) 'Rs_tmp 记录集 ; PageSize 每页显示的记录条数;Incl 其它参数
Dim TotalPage '总页数
Dim PageNo '当前显示的是第几页
Dim RecordCount '总记录条数
If Incl=false then Incl=""
Rs_tmp.PageSize = PageSize
RecordCount = Rs_tmp.RecordCount
TotalPage = INT(RecordCount / PageSize * -1)*-1
PageNo = Request.QueryString ("PageNo")
'直接输入页数跳转;
If Request.Form("PageNo")<>"" Then PageNo = Request.Form("PageNo")
'如果没有选择第几页,则默认显示第一页;
If PageNo = "" then PageNo = 1
If RecordCount <> 0 then
Rs_tmp.AbsolutePage = PageNo
End If

'获取当前文件名,使得每次翻页都在当前页面进行;
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
'取得当前的文件名称,使翻页的链接指向当前文件;
fileName = Mid(fileName,postion)
%>

<form name=pageform method="post" action="<%=fileName%>?PageNo=<%=PageNo%><%=Incl%>">共 <font color=#ff3333><strong><%=rs_tmp.recordcount%></strong></font> 条记录|分 <font color=#ff3333><strong><%=TotalPage%></strong></font> 页|当前第 <strong><font color=#ff3333><%=PageNo%></font></strong> 页
<%If RecordCount = 0 or TotalPage = 1 Then
Response.Write "|<< 首页 < 前页 | 后页 > 末页>|"
Else%>
<a href="<%=fileName%>?PageNo=1<%=Incl%>">|<<
首页</a>
<%If PageNo - 1 = 0 Then
Response.Write "< 前页 |"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo-1%><%=Incl%>"><
前页</a> |
<%End If

If PageNo+1 > TotalPage Then
Response.Write "后页 >"
Else%>
<a href="<%=fileName%>?PageNo=<%=PageNo+1%><%=Incl%>">后页
></a>
<%End If%>
<a href="<%=fileName%>?PageNo=<%=TotalPage%><%=Incl%>">末页>>|</a>
<%End If%>
| 转到第
<%If TotalPage = 1 Then%> <input type=text name=PageNo size=3 readonly disabled style="background:#d3d3d3">
<%Else%> <input type=text name=PageNo size=3 value="" title=请输入页号,然后回车>
<%End If%>

<input type="submit" class=button_index name="Submit" value="提交">
</form>
<%End Sub%>


-------------------------调用---------------------------------------
<td height="25" colspan="11" bgcolor="#FFFFFF">
<%
RowCount = 18 '每页显示的记录条数
incl="&order="&order&"&kinds="&urlkind '翻页时的其它参数
Call TurnPage(Rs,RowCount,Incl)
'公共翻页模块结束%></td>

<%
do while not rs.eof and rowcount>0 '----分页
%>
<tr bgcolor="#FFFFFF">
<td height="25">
<%=rs("urlid")%>
</td>
.......

<%
rowcount=rowcount-1 '-----分页
rs.movenext
loop
%>





zhangm2599 2006-08-30
  • 打赏
  • 举报
回复
其中你这个过程是没有提供代码 ShowHiddenText()
我调试过速度非常快,但是是在没有增加显示项的情况下
zhangm2599 2006-08-30
  • 打赏
  • 举报
回复
我要增加输出我要显示的内容在哪里增加啊
飘零雾雨 2006-08-27
  • 打赏
  • 举报
回复
JF!
first_boy 2006-08-27
  • 打赏
  • 举报
回复
结贴
first_boy 2006-08-27
  • 打赏
  • 举报
回复
我已解决,楼上,你的代码我用不着了,分还是给你!
sunshift 2006-08-26
  • 打赏
  • 举报
回复
ACCESS SQL 通用···

<%
''''''''''''''''''''''''''''''''''''
'' 功能完整的分页程序 + 高效SQL查询语句
'' Power by Love_Computer
'' love_computer@163.com
'' www.56390.com
'' 最后修改时间: 2005-05-26 12:28
'' 使用过程中有任何问题请跟贴,及时答复。
''''''''''''''''''''''''''''''''''''
TableName = "NewsInfo"
FieldName = " * "
SearchWhere = ""
OrderFieldName = "id"
OnlyFieldName = "id"
OrderType = 1
PageSizeNum = 10
Page = Trim(Request.QueryString("page"))
Call ShowTotalPage()
rsTotal = Session("rsTotal")
TotalPages = Session("TotalPages")
CurrentPage = Session("CurrentPage")
Session("rsTotal") = ""
Session("TotalPages") = ""
Session("CurrentPage") = ""
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
PageSQL = GetPageSQL(TableName,FieldName,SearchWhere,OrderFieldName,OnlyFieldName,OrderType,PageSizeNum,CurrentPage)

'''显示分页
Call ShowPages(1,1,1)

'''''创建时间:2005-6-8 15:25 [love_computer@163.com]
''''' www.56390.com
'''''最后修改时间 14:21 2005-8-30
''''获取总页数,总记录数
Sub ShowTotalPage()
Rem 以下内容直接COPY调用,不用任何修改
If Page = "" or IsEmpty(Page) = True or Page = "0" or Page = Empty Then Page = 1
StrWhere = ""
If SearchWhere = "" Then
StrWhere = ""
Else
StrWhere = " WHERE " & SearchWhere
End If
StrTotal = "SELECT COUNT([" & OnlyFieldName & "]) AS [rsTotal] FROM [" & TableName & "] " & StrWhere
Set rsTotalRecord = Conn.Execute(StrTotal)
rsTotal = rsTotalRecord("rsTotal")
rsTotalRecord.Close:Set rsTotalRecord = Nothing
CurrentPage = Page
CurrentPage = Int(CurrentPage)
If rsTotal mod PageSizeNum = 0 Then
TotalPages = int(rsTotal \ PageSizeNum)
Else
TotalPages = int(rsTotal \ PageSizeNum) + 1
End If
If CurrentPage > TotalPages Then CurrentPage = TotalPages
Session("rsTotal") = rsTotal'总记录
Session("TotalPages") = TotalPages'总页数
Session("CurrentPage") = CurrentPage'当前页
End Sub

'''''''''''''显示分页信息
'' www.56390.com
Sub ShowPages(ShowListOrder,ShowSelect,ShowHidden)
If rsTotal <= PageSizeNum Then Exit Sub
StrURL = PageURL
If CurrentPage = 1 Then
PreviousPage = "首页 上页"
Else
PreviousPage = "<a href='" & StrURL & "1'>首页</a> <a href='" & StrURL & CurrentPage - 1 & "'>上页</a>"
End If
If CurrentPage = TotalPages Then
NextPage = "下页 末页"
Else
NextPage = "<a href='" & StrURL & CurrentPage + 1 & "'>下页</a> <a href='" & StrURL & TotalPages & "'>末页</a>"
End If
ShowPageNum = ""
If ShowListOrder = 0 Then
If CurrentPage > 5 Then
xx = CurrentPage - 4
yy = CurrentPage + 5
Else
xx = 1
yy = 10
End If

For ii = xx TO yy
If ii > TotalPages Then Exit For
ShowPageNum = ShowPageNum & " <a href='" & StrURL & ii & "'>["
If ii = CurrentPage Then ShowPageNum = ShowPageNum & "<font color='#FF0000'><b>"
ShowPageNum = ShowPageNum & ii
If ii = CurrentPage Then ShowPageNum = ShowPageNum & "</b></font>"
ShowPageNum = ShowPageNum & "]</a>"
Next
End If

ShowTotal = "共<font color='#FF0000'><b>" & rsTotal & "</b></font>条记录<font color='#FF0000'><b>"
If ShowListOrder = 1 Then
ShowTotal = ShowTotal & CurrentPage & "/"
End If
ShowTotal = ShowTotal & TotalPages & "</b></font>页"
ShowTable = "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
If ShowSelect = 0 Then
ShowTable = ShowTable & "<form name='page' method='get' action=''>"
End If
ShowTable = ShowTable & "<tr><td align='center' valign='middle'>"
ShowTable = ShowTable & PreviousPage & " " & ShowPageNum & " " & NextPage & " " & ShowTotal & " "
Response.Write ShowTable
If ShowHidden = 0 Then
Call ShowHiddenText()
End If
ShowTable = ""
If ShowSelect = 0 Then
ShowTable = ShowTable & "转到<select name='page' onchange='this.form.submit()'>"
For n = 1 TO TotalPages
ShowTable = ShowTable & "<option value='" & n & "'"
If n = CurrentPage Then ShowTable = ShowTable & " selected"
ShowTable = ShowTable & ">" & n & "</option>"
Next
ShowTable = ShowTable & "</select>页"
End If
ShowTable = ShowTable & "</td></tr>"
If ShowSelect = 0 Then
ShowTable = ShowTable & "</form>"
End If
ShowTable = ShowTable & "</table>"
Response.Write ShowTable
End Sub


'''''''获取完整URL
'' 来源于网上 好像是阿信的吧 具体不太清楚啦 HEHE
Function FullURL()
Dim strTemp
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & Request.ServerVariables("SERVER_NAME")
If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")
strTemp = strTemp & Request.ServerVariables("URL")
If Trim(Request.QueryString) <> "" Then strTemp = strTemp & "?" & Trim(Request.QueryString)
FullURL = strTemp
End Function

''''''''''获取URL - 分页专用
'''''''''' Power by Love_Computer...
'''''''''' www.56390.com
Function PageURL()
URL = FullURL
TempUrl = Split(URL,"?")
If ubound(TempUrl) = 0 then
URL = URL & "?page="
Else
TempUrl = Split(URL,"?page=")
If ubound(TempUrl) = 0 Then
TempUrl = Split(URL,"&page")
URL = TempUrl(0) & "&page="
Else
URL = TempUrl(0) & "?page="
End If
End If
PageURL = URL
End Function

''''''''''''分页SQL语句函数
Function GetPageSQL(TableName,FieldName,SearchWhere,OrderFieldName,OnlyFieldName,OrderType,PageSizeNum,Page)
'Power by Love_Computer 2005-05-26 12:28
' www.56390.com
StrWhere = ""
StrOrder = ""
StrSQL = ""
MaxMinID = ""
If SearchWhere = "" Then
StrWhere = ""
MaxMinID = " WHERE ( [" & OnlyFieldName & "] "
Else
StrWhere = " WHERE " & SearchWhere & " "
MaxMinID = " AND ( [" & OnlyFieldName & "] "
End If
If OrderType = 0 Then
MaxMinID = MaxMinID & " > ( SELECT MAX"
StrOrder = " ORDER BY [" & OrderFieldName & "] ASC "
Else
MaxMinID = MaxMinID & " < ( SELECT MIN"
StrOrder = " ORDER BY [" & OrderFieldName & "] DESC "
End If
If Page = 1 or Page = 0 Then
StrSQL = "SELECT TOP " & PageSizeNum & " " & FieldName & " FROM [" & TableName & "] " & StrWhere & StrOrder
Else
StrSQL = "SELECT TOP " & PageSizeNum & " " & FieldName & " FROM [" & TableName & "] " & StrWhere & MaxMinID
StrSQL = StrSQL & " ([" & OnlyFieldName & "]) FROM ( SELECT TOP "
StrSQL = StrSQL & PageSizeNum * (Page - 1) & " [" & OnlyFieldName & "] FROM [" & TableName & "] " & StrWhere & StrOrder
StrSQL = StrSQL & " ) AS TempTable ) ) " & StrOrder
End If
GetPageSQL = StrSQL
End Function
%>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧