DW+ASP数据分页数据显示问题?
使用DW8+ASP绑定记录集,再设置服务器行为可以查询得出SQL中的数据,可是要分页显示第一页是正常,第二页以后就显示空白。代码如下:<%'***MoveToRecord...
使用DW8+ASP绑定记录集,再设置服务器行为可以查询得出SQL中的数据,可是要分页显示第一页是正常,第二页以后就显示空白。代码如下:
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
MM_moveParam = "offset"
If (MM_keepMove <> "") Then
MM_paramList = Split(MM_keepMove, "&")
MM_keepMove = ""
For MM_paramIndex = 0 To UBound(MM_paramList)
MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
End If
Next
If (MM_keepMove <> "") Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove <> "") Then
MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If
MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
MM_movePrev = MM_urlStr & "0"
Else
MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<p align="center"> <span class="STYLE1"><A HREF="<%=MM_moveFirst%>">第一页</A>
<A HREF="<%=MM_movePrev%>">前一页</A>
<A HREF="<%=MM_moveNext%>">下一页</A>
<A HREF="<%=MM_moveLast%>">最后一页</A></p> 展开
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
MM_moveParam = "offset"
If (MM_keepMove <> "") Then
MM_paramList = Split(MM_keepMove, "&")
MM_keepMove = ""
For MM_paramIndex = 0 To UBound(MM_paramList)
MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
End If
Next
If (MM_keepMove <> "") Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove <> "") Then
MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If
MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
MM_movePrev = MM_urlStr & "0"
Else
MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<p align="center"> <span class="STYLE1"><A HREF="<%=MM_moveFirst%>">第一页</A>
<A HREF="<%=MM_movePrev%>">前一页</A>
<A HREF="<%=MM_moveNext%>">下一页</A>
<A HREF="<%=MM_moveLast%>">最后一页</A></p> 展开
1个回答
展开全部
给你一个我刚编的,把你的数据加进去就行了。
<%
Dim db
Set db = Server.CreateObject("Adodb.Connection")
db.Open"Driver={Microsoft Access Driver (*.mdb)};Dbq="&Server.MapPath("rizhi.mdb")
Dim rs,str
Dim pSize,pNum,pCount
Dim flag,k
Set rs = Server.CreateObject("ADODB.Recordset")
str = "SELECT * FROM 表 "
rs.open str,db,1
pSize = 10
If request.QueryString("pNum") = "" Then
pNum = 1
Else
pNum = Cint(request.QueryString("pNum"))
End If
Session("pNum") = pNum
rs.pagesize = pSize
pCount = rs.pagecount
rs.absolutepage = pNum
flag = pSize Do while not rs.eof and flag > 0
flag = flag - 1
%>
<%=rs("你的数据")%>
<% rs.movenext
Loop %>
<%
u = Session("pNum")-1
response.Write("<a href='viewall.asp?pNum=" & 1 & "'>首页 </a> - ")
If pNum = 1 then
response.Write("上一页 - ")
Else
response.Write("<a href='viewall.asp?pNum=" & u & "'>上一页 </a> - ")
End If
For k = 1 to pCount
if k >= Session("pNum")-2 and k < Session("pNum") then
response.Write("<a href='viewall.asp?pNum=" & k & "'>" & k & "</a> - ")
Else if k = Session("pNum") then
response.Write(k & " - ")
Else if k <= Session("pNum")+2 and k > Session("pNum") then
response.Write("<a href='viewall.asp?pNum=" & k & "'>" & k & "</a> - ")
End If
End If
End If
Next
d = Session("pNum")+1
If d = k then
response.Write("下一页 - ")
Else
response.Write("<a href='viewall.asp?pNum=" & d & "'>下一页 </a> - ")
End If
response.Write("<a href='viewall.asp?pNum=" & k-1 & "'>尾页</a> ")
%>
<%
Dim db
Set db = Server.CreateObject("Adodb.Connection")
db.Open"Driver={Microsoft Access Driver (*.mdb)};Dbq="&Server.MapPath("rizhi.mdb")
Dim rs,str
Dim pSize,pNum,pCount
Dim flag,k
Set rs = Server.CreateObject("ADODB.Recordset")
str = "SELECT * FROM 表 "
rs.open str,db,1
pSize = 10
If request.QueryString("pNum") = "" Then
pNum = 1
Else
pNum = Cint(request.QueryString("pNum"))
End If
Session("pNum") = pNum
rs.pagesize = pSize
pCount = rs.pagecount
rs.absolutepage = pNum
flag = pSize Do while not rs.eof and flag > 0
flag = flag - 1
%>
<%=rs("你的数据")%>
<% rs.movenext
Loop %>
<%
u = Session("pNum")-1
response.Write("<a href='viewall.asp?pNum=" & 1 & "'>首页 </a> - ")
If pNum = 1 then
response.Write("上一页 - ")
Else
response.Write("<a href='viewall.asp?pNum=" & u & "'>上一页 </a> - ")
End If
For k = 1 to pCount
if k >= Session("pNum")-2 and k < Session("pNum") then
response.Write("<a href='viewall.asp?pNum=" & k & "'>" & k & "</a> - ")
Else if k = Session("pNum") then
response.Write(k & " - ")
Else if k <= Session("pNum")+2 and k > Session("pNum") then
response.Write("<a href='viewall.asp?pNum=" & k & "'>" & k & "</a> - ")
End If
End If
End If
Next
d = Session("pNum")+1
If d = k then
response.Write("下一页 - ")
Else
response.Write("<a href='viewall.asp?pNum=" & d & "'>下一页 </a> - ")
End If
response.Write("<a href='viewall.asp?pNum=" & k-1 & "'>尾页</a> ")
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询