运行第一次时成功,第二次...失败????????

wubb 2000-05-11 11:18:00
代码如下:
<%
If application("topthree")="" then
sql="select top 3 * from activeinfo order by Date desc"
DbPath = SERVER.MapPath("../activeinfo/activeinfo.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath
Set rs = conn.Execute( sql )
Set application("topthree") = rs
else
Set rs = application("topthree")
End If
%>
第一次运行时,也就是application("topthree")为空时,成功,若
application("topthree")非空时,错误信息如下:
错误类型:
Microsoft VBScript 运行时错误 (0x800A000D)
p1.asp, 第 2 行
若在前面加一行application("topthree")="",则成功运行,但是,我的目的,嘿嘿。
请大虾不吝赐教,谢谢
...全文
223 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
蝈蝈俊 2000-05-11
  • 打赏
  • 举报
回复
Set application("topthree") = rs
是传的指针,第二次进入时application("topthree")还在,但rs不在了。

试试:
<%
If application("topthree")="" then
sql="select top 3 * from activeinfo order by Date desc"
DbPath = SERVER.MapPath("../activeinfo/activeinfo.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath
Set application("topthree") = conn.Execute( sql )
else
Set rs = application("topthree")
End If
%>

Un1 2000-05-11
  • 打赏
  • 举报
回复
试试:

If IsEmpty(application("topthree")) then
...
Set application("topthree") = rs
else
Set rs = application("topthree")
End If

Dannel 2000-05-11
  • 打赏
  • 举报
回复
你的Rs是什么,是记录对象吗?

类型不对,怎么能"="呢

28,390

社区成员

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

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