网上最常见的分页出现错误了!
代码如下:
<!--#include FILE="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charecet=gb2312">
<title>无标题文档</title>
<link href="css/showzuopin.css" rel="stylesheet" type="text/css">
</head>
<body >
<%
'conn.Open
set rec=server.createobject("ADODB.recordset")
strecql="select * from up_Images "
rec.open strecql,conn,1,1
PgSz=5
If rec.RecordCount=0 then
response.write "<P><center>对不起,数据库中没有相关信息!</center></P>"
else
rec.PageSize = Cint(PgSz) '设定PageSize属性的值
Total=INT(rec.recordcount / PgSz * -1)*-1 '计算可显示页面的总数
PageNo=Request("pageno")
if PageNo="" Then
PageNo = 1
else
PageNo=PageNo+1
PageNo=PageNo-1
end if
ScrollAction = Request("ScrollAction")
if ScrollAction = " 上一页 " Then
PageNo=PageNo-1
end if
if ScrollAction = " 下一页 " Then
PageNo=PageNo+1
end if
if PageNo < 1 Then
PageNo = 1
end if
n=1
rec.AbsolutePage = PageNo
Response.Write "< CENTER>"
position=rec.PageSize*PageNo
pagebegin=position-rec.PageSize+1
if position < rec.RecordCount then
pagend=position
else
pagend= rec.RecordCount
end if
Response.Write "< P>< font color='Navy'>< B>数据库查询结果:< /B>"
Response.Write "(共有"&rec.RecordCount &"条符合条件的信息,显示"&pagebegin&"-"&pagend&")< /font>< /p>"
Do while not (rec is nothing)
RowCount = rec.PageSize
Do While Not rec.EOF and rowcount > 0
If n=1 then
Response.Write "< TR BGCOLOR=#FFFFFF>"
ELSE
Response.Write "< TR BGCOLOR=#EEEEEE>"
End If
n=1-n%>
<td rowspan=3 class=a3 align="center"> <p class="unnamed1"> </p>
<table width="62%" height="155" border="1" bordercolor="#CCCCCC">
<tr>
<td width="43%" height="22"><img src="images/arrow.gif" width="4" height="13"><span style="font-size:9pt">[<%=rec("i_Title")%>]</span></td>
<td width="18%"><span style="font-size:9pt">[<%=rec("uptime")%>]</span></td>
<td width="16%"> </td>
<td width="23%"> </td>
</tr>
<tr>
<td colspan="4"><img src="<%= rec("i_Url")%>" onload='javascript:if(this.width>200)this.width=200'></td>
</tr>
</table></td>
<p class="unnamed1">
<%
RowCount = RowCount - 1
rec.MoveNext
Loop
set rec = rec.NextRecordSet
Loop
Conn.Close
set rec=nothing
set conn=nothing
%>
<FORM METHOD="GET" ACTION="list.asp">
<INPUT TYPE="HIDDEN" NAME="pageno" VALUE="< % =PageNo %>">
<%
if PageNo > 1 Then
response.write "<INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE=' 上一页 '>"
end if
if RowCount = 0 and PageNo <>Total then
response.write "<INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE=' 下一页 '>"
end if
response.write "</FORM>"
End if
%>
</body >
</html>
技术信息(用于支持人员)
错误类型:
ADODB.Recordset (0x800A0CB3)
当前提供程序不支持从单一执行返回多个记录集。
/bbs/TMPaj6t4hcks9.asp, 第 76 行
浏览器类型: