翻页问题,急啊。
可以翻页,但是下一页的内容和第一页的是一样的。哪位高手可以帮我,非常急啊。代码如下,哪位朋友帮我分析一下,谢谢。
<%
Dim class2,class3,id,prm1,prm2,maxnum,max,link
id=int(request("id"))
page=int(request.QueryString("page"))
If page=0 Then
page=1
End If
set cmd=Server.CreateObject(")
cmd.ActiveConnection=conn
set class4num=cmd.CreateParameter("@class4",3,1)
cmd.Parameters.Append class4num
cmd("@class4")=id
set pagenum=cmd.CreateParameter("@pagenum",3,1)
cmd.Parameters.Append pagenum
cmd("@pagenum")=page
set maxnum=cmd.CreateParameter("@maxnum",3,2)
cmd.Parameters.Append maxnum
cmd.execute()
max=cmd("@maxnum")
cmd.Prepared=true
Set rs=cmd.execute
rs.AbsolutePage=page
If (rs.Bof and rs.Eof) Then
response.Write("<br><br><center><span class='css'>很抱歉,没有找到符合您查询条件的商户……</span></center>")
Else
%>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0" class="css">
<tr>
<td width="4%" height="25"><img src="../images/list.gif" width="15" height="15"></td>
<td width="96%" valign="bottom"><%=rs("class4name")%>&nbsp;<font color="#FF0000">(<%=max%>)</font></td>
</tr>
</table>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0" class="p9">
<tr>
<td colspan="4" bgcolor="65CA00"><img src="../../images/block.gif" width="1" height="2"></td>
</tr>
<tr>
<td width="214" height="25" align="left" bgcolor="E8F6D9">商户名称</td>
<td width="95" align="left" bgcolor="E8F6D9">折扣</td>
<td width="208" align="left" bgcolor="E8F6D9">地址</td>
<td width="50" align="center" bgcolor="E8F6D9">详情</td>
</tr>
<tr>
<td colspan="4" bgcolor="65CA00"><img src="../../images/block.gif" width="1" height="1"></td>
</tr>
</table>
<%
Do While Not rs.Eof
If rs("istb")=True Then
link=""&rs("url")&""
Else
link="cust.asp?id="&rs("id")&""
End If
%>
<TABLE width="92%" border=0 align=center cellPadding=0 cellSpacing=0 class="css">
<TR>
<TD width="216" height=20 align="left"><a href=<%=link%> target="_blank"><%=left(rs("name"),11)%></A></TD>
<TD width="95" align="left"><a href=<%=link%> target="_blank"><%=left(rs("actor"),11)%></A></TD>
<TD width="206" align="left"><a href=<%=link%> target="_blank"><%=left(rs("add1"),11)%></A></TD>
<TD width="50" align=center><a href=<%=link%> target="_blank">查看</A></TD>
</TR>
<tr>
<td colspan="4" background="../images/dot_02.gif"><img src="../images/block.gif" width="1" height="1"></td>
</tr>
</table>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="65CA00"><img src="../../images/block.gif" width="1" height="1"></td>
</tr>
</table>
<%
rs.movenext
Loop
%>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0" class="p9">
<tr>
<td height="25" align="center" bgcolor="E8F6D9">
<%
totalnum=int((max-1)/10)
if totalnum<0 Then
totalnum=0
End If
totalnum=totalnum+1
If totalnum<=1 Then
response.Write "上一页<img src='../../images/consume/mark_prev_ten.gif' width='13' height='11'>&nbsp;&nbsp;&nbsp;&nbsp;"
response.Write "1 | 2| 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10"
response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<img src='../../images/consume/mark_next_ten.gif' width='13' height='11'>下一页"
Else
response.Write "上一页<img src='../../images/consume/mark_prev_ten.gif' width='13' height='11'>&nbsp;&nbsp;&nbsp;&nbsp;"
If page>=10 then
response.write"<a href=consumelist.asp?id="&request.QueryString("id")&"&page="&(((cstr(page)\10)-1)*10)+1&">上十页<img src='../../images/consume/mark_prev_ten.gif' width='13' height='11'>&nbsp;&nbsp;&nbsp;&nbsp;</a>&nbsp;"
End if
q=(cstr(page)-1)\10
If q<0 then
q=1
End if
p=(q*10)+1
Do while p<((q*10)+11)
If p=page Then
If page<totalnum then
Response.Write p&"|&nbsp"
Else
Response.Write p&"&nbsp"
End if
Elseif p<totalnum then
Response.Write "<a href=consumelist.asp?id="&request.QueryString("id")&"&page="&p&">"&p&"</a>|&nbsp"
Elseif p=totalnum then
Response.Write "<a href=consumelist.asp?id="&request.QueryString("id")&"&page="&p&">"&p&"</a>&nbsp"
End If
p=p+1
Loop
response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<img src='../../images/consume/mark_next_ten.gif' width='13' height='11'>下一页"
A=totalnum
If (A mod 10)=0 then
A=totalnum-1
End if
If page<(A\10)*10 then
response.write"<a href=consumelist.asp?id="&request.QueryString("id")&"&page="&((((cstr(page)-1)\10)+1)*10)+1&">&nbsp;&nbsp;&nbsp;&nbsp;<img src='../../images/consume/mark_next_ten.gif' width='13' height='11'>下十页</a>"
End if
End If
%>
</td>
</tr>
</table>
<table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="65CA00"><img src="../../images/block.gif" width="1" height="2"></td>
</tr>
</table>
<%
End If
call closeall()
%>
</td>
</tr>
</table>
</td>
<td width="1" bgcolor="#CCCCCC"><img src="../images/block.gif" width="1" height="1"></td>
</tr>
</table>