asp报错:Microsoft VBScript 运行时错误 '800a01a8'

sampled 2012-12-20 03:56:26
系统在生成前台静态页面的时候出错,有些前台页面可以正常生成,有的不能

报错信息如下:
Microsoft VBScript 运行时错误 '800a01a8'

缺少对象: 'ars2'

\hhmm\zm_productview.asp, line 227



--------------------------------------------------------------------------------
[Aws V2.3]



文件zm_productview.asp如下

<%

'==读取产品内容
'id=255
id=Request("id")
if id="" or not isnumeric(id) then
Response.Write("<script>alert('访问参数错误!');document.location.href('default.asp');</script>")
Response.End()
end if

sql="select * from zm_product where id="&id
set rs=server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
typeid=rs("Tid")

'==所在位置
possql="select * from Zm_Product_Type where id="&rs("Tid")
set posrs=conn.execute(possql)
if not posrs.eof then
pro_class_id=posrs("id")
pro_class_pid=posrs("pid")
pro_class=posrs("Name")
if pro_class_pid<>0 then
possqlb="select * from Zm_Product_Type where id="&pro_class_pid
set posrsb=conn.execute(possqlb)
pro_class_id=posrsb("id")
pro_class=posrsb("Name")
posrsb.close
set posrsb=nothing
end if
end if
posrs.close
set posrs=nothing

pos = "<a href='/index.html'>首页</a> > <a href='/product_"&pro_class_id&".html' target='_self'>"&pro_class&"</a> > "
pos = pos &"<a href='product_view_"&id&".html'>"&rs("name")&"</a>"

if rs.eof then
Response.Write("<script>alert('参数错误!');document.location.href('default.asp');</script>")
Response.End()
end if
rs("hit")=rs("hit")+1
rs.update
productname=rs("name")
producttime=rs("addtime")
producthit=rs("hit")
productinfo=rs("info")
productimg="<img src='/hhmm/UpLoadfiles/upLoadImages/"&rs("img")&"' />"
Product_Other_Info = "<table id='pro_table_poi'><tr><td width='100'>产品名称:</td><td class='pro_table_mtd_poi pro_table_proname_poi'>" & rs("name") & "</td></tr><tr><td class='pro_table_ltd_poi'>产品编号:</td><td class='pro_table_mtd_poi'>" & rs("pro_code") & "</td></tr><tr><td class='pro_table_ltd_poi'>所属类别:</td><td><a href='/product_"&pro_class_id&".html' target='_self'>" &pro_class&"</a> >> "& rs("sort_name") & "</td></tr><tr><td class='pro_table_ltd_poi pro_table_remarks_poi'>"&productname&"报价:</td><td class='pro_table_mtd_poi pro_table_remarks_poi'>" & rs("remarks") & "</td></tr></table>"
seo_t=rs("seo_t")
seo_k=rs("seo_k")
seo_d=rs("seo_d")
seo_r_p = rs("re_pro")
seo_r_n = rs("re_news")
rs.close
set rs=nothing

'== 读取内页友情链接
sqllink="select top 20 * from zm_link1 order by ord asc"
link1="<ul><li>  </li>"
Set rslink=conn.execute(sqllink)
i = 1
do while not rslink.eof
if i = 1 then
link1=link1&"<li><a href='"&rslink("url")&"' target='_blank'>"&rslink("name")&"</a></li>"
else
link1=link1&"  |  <li><a href='"&rslink("url")&"' target='_blank'>"&rslink("name")&"</a></li>"
end if
i = i + 1
rslink.MoveNext
loop
link1=link1&"</ul>"
rslink.Close
Set rslink=Nothing


psql1="select * from pro_about where TypeID="&typeid
set prs1=conn.execute(psql1)
if not prs1.eof then
keyword1=prs1("keyword1")
keyword2=prs1("keyword2")
count1=prs1("count1")
count2=prs1("count2")
onoff1=prs1("onoff1")
onoff2=prs1("onoff2")
pro_type1=keyword1
pro_type2=keyword2
prs1.close
set prs1=nothing
else
onoff1=false
onoff2=false
pro_type1=""
pro_type2=""
end if



psql2="select * from news_about where TypeID="&id
set prs2=conn.execute(psql2)
if not prs2.eof then
keyword3=prs2("keyword1")
keyword4=prs2("keyword2")
count3=prs2("count1")
count4=prs2("count2")
onoff3=prs2("onoff1")
onoff4=prs2("onoff2")
news_type1=keyword3
news_type2=keyword4
prs2.close
set prs2=nothing
else
onoff3=false
onoff4=false
news_type1=""
news_type2=""
end if

'if count1=0 then count1=5
'if count2=0 then count2=5
'if count3=0 then count3=5
'if count4=0 then count4=5

'左侧相关产品
product_left_about1=""

if onoff1=true then
if count1<>0 and keyword1<>"" then
asql1="select top "&count1&" * from Zm_Product where Name like '%"&keyword1&"%' order by id desc"
set ars1=conn.execute(asql1)
if not ars1.eof then
i=1
do while not ars1.eof
product_left_about1=product_left_about1&"<li><a href=/product_view_"&ars1("id")&".html>"&ars1("Name")&"</a></li>"
ars1.movenext
i=i+1
if i>count1 then exit do
loop
else
product_left_about1="    <span>    暂无任何相关信息</span>"
end if
ars1.close
set ars1=nothing
else
product_left_about1="    <span>    暂无任何相关信息</span>"
end if

else
product_left_about1="    <span>    暂无任何相关信息</span>"
end if


product_left_about2=""
if onoff2=true then
if count2<>0 and keyword2<>"" then
asql2="select top "&count2&" * from Zm_Product where Name like '%"&keyword2&"%' order by id desc"
set ars2=conn.execute(asql2)
if not ars2.eof then
i=1
do while not ars2.eof
product_left_about2=product_left_about2&"<li><a href=/product_view_"&ars2("id")&".html>"&ars2("Name")&"</a></li>"
ars2.movenext
i=i+1
if i>count2 then exit do
loop
else
product_left_about2="    <span>    暂无任何相关信息</span>"
end if
ars2.close
set ars2=nothing
else
product_left_about2="    <span>    暂无任何相关信息</span>"
end if

else
product_left_about2="    <span>    暂无任何相关信息</span>"
end if

'左侧相关新闻
news_left_about1=""
if onoff3=true then
if count3<>0 and keyword3<>"" then
asql1="select top "&count3&" * from Zm_News where Title like '%"&keyword3&"%' order by id desc"
'response.Write asql1
'response.End()
set ars1=conn.execute(asql1)
if not ars1.eof then
i=1
do while not ars1.eof
news_left_about1=news_left_about1&"<li><a href=/news_view_"&ars1("id")&".html>"&ars1("Title")&"</a></li>"
ars1.movenext
i=i+1
if i>count3 then exit do
loop
else
news_left_about1="    <span>    暂无任何相关信息</span>"
end if
ars1.close
set ars1=nothing
else
news_left_about1="    <span>    暂无任何相关信息</span>"
end if

else
news_left_about1="    <span>    暂无任何相关信息</span>"
end if

news_left_about2=""
if onoff4=true then
if count4<>0 and keyword4<>"" then
asql2="select top "&count4&" * from Zm_News where Title like '%"&keyword4&"%' order by id desc"
set ars2=conn.execute(asql2)
if not ars2.eof then
i=1
do while not ars2.eof
news_left_about2=news_left_about2&"<li><a href=/news_view_"&ars2("id")&".html>"&ars2("Title")&"</a></li>"
ars2.movenext
i=i+1
if i>count4 then exit do
loop
else
news_left_about2="    <span>    暂无任何相关信息</span>"
end if
else
news_left_about2="    <span>    暂无任何相关信息</span>"
end if
ars2.close
set ars2=nothing
else
news_left_about2="    <span>    暂无任何相关信息</span>"
end if


'获取相关产品
if seo_r_p <> "" then
rele_product = "<table border='0' width='630'>"
re_pro_id = Split(seo_r_p)
j=1
for i = 0 to Ubound(re_pro_id)
sql2 = "select * from zm_product where id = " & Cint(re_pro_id(i))
set rs2 = Conn.Execute(sql2)
' do while not rs2.eof
if j mod 8 = 1 then
rele_product = rele_product & "<tr><td><a href='/product_view_" & rs2("id") & ".html'> " & rs2("name") & "</a></td>"
elseif j mod 8 = 0 then
rele_product = rele_product & "<td><a href='/product_view_" & rs2("id") & ".html'> " & rs2("name") & "</a></td></tr>"
else
rele_product = rele_product & "<td><a href='/product_view_" & rs2("id") & ".html'> " & rs2("name") & "</a></td>"
end if
' rs2.Movenext
j = j + 1
' loop
rs2.Close()
Set rs2 = Nothing
next
' if j mod 8 = 0 then
' rele_product = rele_product & "</tr></table>"
' else
rele_product = rele_product & "</table>"
' end if
end if

'获取相关信息
if seo_r_n <> "" then
sql2 = "select top 8 * from zm_news where Title like '%" & seo_r_n & "%'"
set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.Open sql2, conn, 1, 3
rele_info = "<ul>"
do while not rs2.eof
rele_info = rele_info & "<li><a href='/news_view_"&rs2("Id")&".html' target='_self'> "&rs2("Title")&"</a>   ["&datevalue(rs2("Addtime"))&"]</li>"
rs2.MoveNext
loop
rele_info = rele_info & "</ul>"
rs2.Close
Set rs2 = Nothing
end if
%>
...全文
473 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
sampled 2013-01-08
  • 打赏
  • 举报
回复
问题解决了,是代码对的问题,没有很好的闭合
sampled 2012-12-20
  • 打赏
  • 举报
回复
上面报错信息中第227行的代码片段是以下片段 ars2.close set ars2=nothing else news_left_about2="    <span>    暂无任何相关信息</span>" end if 多谢各位高手指教

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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