Microsoft VBScript 运行时错误 '800a01a8' 缺少对象: ''

Lee0510 2013-09-17 10:26:50
求助大虾们的问题如下:
首先,我想自己做了一个index,我想把别的ASP里面的一个功能模块copy(抠)出来
我把对应的conn还有 .mdb 任何相关的东西都copy过来了
但是抠出来的源代码在我的index里面运行出现如下错误
Microsoft VBScript 运行时错误 '800a01a8' 缺少对象: '' index.asp, line 161

copy模块代码:
<tr>
<td colspan="5" align="left" valign="bottom"><div align="center">
<% '显示特价商品,goodsstate="2"为特价商品
sql="select top 5 * from goods where goodsstate='2' order by pid desc"
rs.open sql,conn,1,1
if rs.recordcount<>0 then
do while not rs.eof %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%"><img src="image/p_arrow.gif" width="15" height="15"></td>
<td width="41%"><a href="goodsdetail.asp?pbm=<%=rs("pbm")%>"><%=left(trim(rs("pname")),6)%></a></td>
<td width="18%"><div align="right"><font color="#ff0000">¥</font><%=formatnumber(trim(rs("price")),2)%></div></td>
<td width="16%"><div align="right"><font color="#ff0000">¥</font><%=formatnumber(cdbl(trim(rs("dz")))*cdbl(trim(rs("price")))/100,2)%></div></td>
<td width="20%"><div align="center"><a href="shoppingbagadd.asp?pbm=<%=rs("pbm")%>"><img src="image/shoping_01.gif" width="23" height="20" border="0"></a></div></td>
</tr>
</table>
<% rs.movenext
loop
else
response.write "对不起还没有商品!"
end if
rs.close %></div></td>
</tr>


我把这些代码抠到自己的一个table tr 下 和源代码的格式是一样的 但是在它的项目环境中 是没问题的
在我的项目环境中就出问题了。 请问我是对什么对象没定义?


求解中.......
相互学习,不胜感激。
...全文
4454 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
hookee 2013-09-18
  • 打赏
  • 举报
回复
1. include时 conn.asp 的路径 对不对 2 Set rs = CreateObject("ADODB.RecordSet") 3 conn.Open后查一下 conn.State是不是打开状态 <>0 不是的话,查mdb路径和文件权限
Lee0510 2013-09-18
  • 打赏
  • 举报
回复
引用 10 楼 hookee 的回复:
1. include时 conn.asp 的路径 对不对 2 Set rs = CreateObject("ADODB.RecordSet") 3 conn.Open后查一下 conn.State是不是打开状态 <>0 不是的话,查mdb路径和文件权限
Step 2解决问题 Execllent! Thanks advance!
Lee0510 2013-09-17
  • 打赏
  • 举报
回复
引用 7 楼 caozhy 的回复:
那你include进来了么?
index 最开头我写了这么一句<!--#include file="conn.asp"--> <!-- 包含首导 --> 不会没起作用吧?
Lee0510 2013-09-17
  • 打赏
  • 举报
回复
引用 5 楼 caozhy 的回复:
事实上rs也没有定义。
项目文件里面有一个conn.asp 和 conn.inc 我以为这样就定义了 我在index最开始加了这样一句 <!--#include file="conn.asp"--> <!-- 包含首导 --> 还是没有起到定义的作用么
threenewbee 2013-09-17
  • 打赏
  • 举报
回复
那你include进来了么?
Lee0510 2013-09-17
  • 打赏
  • 举报
回复
引用 5 楼 caozhy 的回复:
事实上rs也没有定义。
在conn.asp里面有定义吧?还是需要在index里面也要定义? <% option explicit '要求系统中使用的变量都必须预先声明,此句需放在程序代码的最前面。 '打开数据库,建立与数据库的连接。 dim conn,connstr,rs,sql Set conn = Server.CreateObject("ADODB.Connection") connstr="DBQ="&Server.MapPath("data/babyshop.mdb")&";DRIVER={Microsoft Access Driver (*.mdb)}" conn.Open connstr %>
threenewbee 2013-09-17
  • 打赏
  • 举报
回复
事实上rs也没有定义。
threenewbee 2013-09-17
  • 打赏
  • 举报
回复
conn在哪里定义的?
Lee0510 2013-09-17
  • 打赏
  • 举报
回复
谢谢1楼回帖哈,我写那个161只是错误的描述,我自己的index代码其他全是样式和层的东西 太多了 也对解决问题起不到更好的描述作用 也是我没说清楚 Microsoft VBScript 运行时错误 '800a01a8' 缺少对象: '' index.asp, line 161 line 161 = rs.open sql,conn,1,1 说白了 我代码运行到这就出错了 不继续运行下去了 但是我不清楚我自己项目文件里面到底哪里没有声明对象。 还请耐心帮忙啊
Andy__Huang 2013-09-17
  • 打赏
  • 举报
回复
<img src="image/shoping_01.gif" width="23" height="20" border="0"> 少了一个钭扛,改为下面试试 <img src="image/shoping_01.gif" width="23" height="20" border="0"/>
threenewbee 2013-09-17
  • 打赏
  • 举报
回复
asp的问题去web开发-asp板块问。 天知道你贴的这乱七八糟的哪个是第161行。

28,391

社区成员

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

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