分页出错了!提示 错误类型:ADODB.Recordset (0x800A0E78)对象关闭时,不允许操作 integral_query.asp,第 63 行
zzg16 2009-09-10 03:55:40 <!-- #include file="conn.asp"-->
<script language=javascript>
function mm()
{
var a = document.getElementsByTagName("input");
if(a[0].checked==true){
for (var i=0; i<a.length; i++)
if (a[i].type == "checkbox") a[i].checked = false;
}
else
{
for (var i=0; i<a.length; i++)
if (a[i].type == "checkbox") a[i].checked = true;
}
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>积分查询页面</title>
</head>
<body>
<%'开始分页
Const MaxPerPage=20 '每页显示最大记录为20
dim totalPut '总记录数
dim CurrentPage '当前页
dim TotalPages '总页数
dim j
dim sqlstr
'如果是从确定页面传过来的page值,则使用传过来的值,否则使用默认值
if Not isempty(request("page")) then
currentPage=Cint(request("page"))'获取客户端传递过来的值
else
currentPage=1
end if
dim namekey,checkbox,action
action=request.QueryString("action")
checkbox=request("checkbox")
namekey=request("namekey")
if namekey="" then namekey=request.QueryString("namekey") end if
if checkbox="" then checkbox=request.querystring("checkbox") end if
set rs=server.CreateObject("adodb.recordset")
'模糊查询
if namekey="" then
select case action
case "all"
rs.open "select userid,username,point,yucun from sh_user order by adddate desc",conn,1,1
end select
else
if checkbox=1 then
rs.open "select userid,username,point,yucun from sh_user where username like '%"&namekey&"%' order by adddate desc",conn,1,1
else
rs.open "select userid,username,point,yucun from sh_user where username='"&namekey&"' order by adddate desc ",conn,1,1
end if
end if
'分页显示
if err.number<>0 then
response.write "数据库中无数据"
end if
if rs.eof And rs.bof then ‘就这里总是报错 XXXXXXXXXXX
Response.Write "<p align='center' class='contents'> 现在没有可生成的积分和预存款!</p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"integral_query.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"integral_query.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"integral_query.asp"
end if
end if
end if
sub showContent
dim i
i=0
%>
<form name="form1" method="post" action="integral_query?action=del">
<table cellpadding="3" cellspacing="1" border="0" width="90%" class="tableBorder" align=center>
<tr>
<th class="tableHeaderText" colspan=11>预存款和积分</th>
</tr>
<tr>
<td class="forumRowHighlight" width="8%"> <div align="center">用户编号</div></td>
<td class="forumRowHighlight" width="8%"> <div align="center">用户名</div></td>
<td class="forumRowHighlight" width="9%"> <div align="center">总积分</div></td>
<td class="forumRowHighlight" width="16%"> <div align="center">总预存款</div></td>
</tr>
<%do while not rs.eof%>
<tr>
<td class="forumRowHighlight"> <div align="center"><%=trim(rs("userid"))%></div></td>
<td class="forumRowHighlight"> <div align="center"><%=trim(rs("username"))%></div></td>
<td class="forumRowHighlight"><div align="center"><%=rs("jifen")%>分</div></td>
<td class="forumRowHighlight"><div align="center"><%=rs("yucun")%>元</div></td>
</tr>
<% i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop %>
</table>
</form>
<%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If
Response.Write "<form method=Post action="&filename&"?action="&action&"&checkbox="&checkbox&"&namekey="&namekey&">"
Response.Write "<p align='center' class='contents'> "
If CurrentPage<2 Then
Response.Write "<font class='contents'>首页 上一页</font> "
Else
Response.Write "<a href="&filename&"?action="&action&"&page=1&checkbox="&checkbox&"&namekey="&namekey&" class='contents'>首页</a> "
Response.Write "<a href="&filename&"?action="&action&"&page="¤tPage-1&"&checkbox="&checkbox&"&namekey="&namekey&" class='contents'>上一页</a> "
End If
If n - currentpage<1 Then
Response.Write "<font class='contents'>下一页 尾页</font>"
Else
Response.Write "<a href="&filename&"?action="&action&"&page="&(CurrentPage+1)&"&checkbox="&checkbox&"&namekey="&namekey&" class='contents'>"
Response.Write "下一页</a> <a href="&filename&"?action="&action&"&page="&n&"&checkbox="&checkbox&"&namekey="&namekey&" class='contents'>尾页</a>"
End If
Response.Write "<font class='contents'> 页次:</font><font class='contents'>"¤tPage&"</font><font class='contents'>/"&n&"页</font> "
Response.Write "<font class='contents'> 共有"&totalnumber&"条充值记录"
Response.Write "<font class='contents'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="¤tpage&">"
Response.Write " <input type='submit' class='button' value='GO' name='cndok'></form>"
End Function
%>
<br>
<table cellpadding="3" cellspacing="1" border="0" width="90%" class="tableBorder" align=center>
<form name="form2" method="post" action="integral_query.asp?action=all">
<tr>
<th class="tableHeaderText" colspan=6>查找用户</th>
</tr>
<tr>
<td class="forumRowHighlight" align=left> 按用户名查找:
<input name="namekey" type="text" id="namekey" size="12"> <input name="checkbox" type="checkbox" id="checkbox" value="1" checked>
模糊查询
<input class=button type="button" name="Submit2" value="查 询" onClick="return checksubmit();" style="cursor:hand;"></td>
</tr>
</form>
</table>
<br>
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
<!--
//验证管理员是否输入了搜索关键字--------------------------------------------
function checksubmit()
{
if(checkspace(document.form2.namekey.value)) {
document.form2.namekey.focus();
alert("请输入用户关键字!");
return false;
}
form2.submit()
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
//-->
</script>
如题,
错误类型:ADODB.Recordset (0x800A0E78)对象关闭时,不允许操作 integral_query.asp,第 63 行
63行就是这里:
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 现在没有可生成的积分和预存款!</p>"