ADODB.Recordset 错误 '800a0e7d' 急死了,大哥们99999啊!

shidai1208 2009-05-21 04:22:32
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>春天家私 </title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#F8F8F2" topmargin="0">
<!--#include file="top.asp"-->
<table width="946" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="199" align="right" valign="top">
<div style="padding-left:13px;">
<!--#include file="left.asp"-->
</div>
</td>
<td width="40"> </td>
<td width="642" valign="top">
<table width="696" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="102"> <img src="images/1_11.gif" width="102" height="35" alt="" /> </td>
<td width="584" align="right" background="images/1_12.gif" bgcolor="#F8F8F2">  </td>
<td width="10"> <img src="images/1_17.gif" width="6" height="35" alt="" /> </td>
</tr>
</table>
<table> <tr> <td height="5"> </td> </tr> </table>
<table width="693" border="0" cellpadding="0" cellspacing="0" class="td2">
<tr>
<td width="502" height="10"> </td>
<td width="189" align="center"> </td>
</tr>

<%
menu_id=request("menu_id")
if menu_id <> "" then

sql="select * from news where (menu1 =" &cint(menu_id)& "or menu2 ="&cint(menu_id)& ")order by ontop desc,id desc"
else
sql="select * from news order by ontop desc,id desc"
end if

set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.bof then
page=1
rs.PageSize = 10
if Not IsEmpty(Request("Page")) then
Page = CInt(Request("Page"))
if Page > rs.PageCount then
rs.AbsolutePage = rs.PageCount
elseif Page <= 0 then
Page = 1
else
rs.AbsolutePage = Page
end if
End if
TotalPages = rs.PageCount

For i = 1 to rs.PageSize
if rs.EOF then
Exit For
end if
times=year(rs("time"))&"-"&month(rs("time"))&"-"&day(rs("time"))
%>
<tr>
<td height="30" class="z_td"> <img src="images/1.gif" width="18" height="7" /> <a href="../main/article.asp?id= <%=rs("id")%>" target="_blank"> <%=rs("title")%> </a> </td>
<td height="30" align="center">[ <%=times%>] </td>
</tr>


<%
rs.movenext
next
%>

<tr>
<td height="5" colspan="2" background="images/g5.gif"> </td>
</tr>
<tr> <form action="news.asp" >
<td height="30" colspan="2" align="left"> <div style="padding-left:265px; padding-top:10px;">共 <span class="red"> <%=rs.recordcount%> </span> 篇新闻 第 <span class="red"> <%= page %> </span>页/共 <%= TotalPages %>页   

<%
If page > 1 Then%>
<a href="news.asp?page= <%= (page-1)%>&menu_id= <%=menu_id%>">上一页 </a>|
<% End If
If page <> TotalPages Then%>
<a href="news.asp?page= <%= (page+1)%>&menu_id= <%=menu_id%>">下一页 </a>
<% End If %> 跳到 

<select name="select" onChange="Menu(this,'window',false)">
<option value=""> </option>
<%
for j=1 to rs.PageCount

%>
<option value="news.asp?page= <%=j%>&menu_id= <%=menu_id%>"> <%=j%> </option>
<%next%>
</select>

</td> </form>
</tr>
</table>
<table width="694" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5" height="43" background="images/talbe_news_t_10.jpg">  </td>
<td background="images/talbe_news_t_bg5.jpg">  </td>
<td width="127" background="images/talbe_news_t_11.jpg">  </td>
</tr>
</table> </td>
<td width="16" valign="top">  </td>
</tr>
</table>
<%
end if
rs.close
conn.close
set conn = nothing
set rs = nothing
%>
<!--#include file="bottom.asp"-->
</body>
</html>

错误信息:
ADODB.Recordset 错误 '800a0e7d'
连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。
行 44 (加红处)


看了没错,数据库也有数据的,请问是什么问题呢?怎样修改代码?
...全文
316 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zsyzzz 2009-05-22
  • 打赏
  • 举报
回复
数据库没打开啊 晕
BlueSky4014 2009-05-21
  • 打赏
  • 举报
回复
conn 有打开链接吗
即在你调用的conn 有没有 conn.open 之类的语句
是conn没有打开或已关闭的原因
BobHe 2009-05-21
  • 打赏
  • 举报
回复
conn 没有连接

28,390

社区成员

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

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