分页出错了!提示 错误类型: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>"
...全文
151 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zzg16 2009-09-16
  • 打赏
  • 举报
回复
谢谢各位。问题解决了。散分
调皮的蟠桃 2009-09-11
  • 打赏
  • 举报
回复
没有创建对象,不能执行查询。set rs=server.CreateObject("adodb.recordset")放的位置不对。
凡夫与俗子 2009-09-11
  • 打赏
  • 举报
回复
提示很清楚了啊,recordset创建了在关闭前不能重复使用它。必须关闭或者另外创建一个。
liuwei_IT_love 2009-09-10
  • 打赏
  • 举报
回复
你包含了数据库链接文件为什么还要这句?set rs=server.CreateObject("adodb.recordset")之后有没有任何打开的语句:rs.open str,db,1等等语句
liuwei_IT_love 2009-09-10
  • 打赏
  • 举报
回复
<!-- #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>
打开数据库链接的语句open呢?怎么就这一句:set rs=server.CreateObject("adodb.recordset")
ZSJ_COOL 2009-09-10
  • 打赏
  • 举报
回复

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 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
这个思维 如果 namekey="" 并且 action<>all 你的语句 该如何执行呢?
zzg16 2009-09-10
  • 打赏
  • 举报
回复
哥们能说具体点吗?还有我用response.Write "<script language='javascript'>alert('打印了下变量值!');window.location.href='login.asp';</script>"
可它就是不走。直接报错。
谢谢啊。我在线等各位
asdfasdfdfas 2009-09-10
  • 打赏
  • 举报
回复
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


可能这里有问题,

28,405

社区成员

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

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