在现等待解答,关于ASP多次连接数据库的问题,请进来听我详细说明一下

lcfjs 2011-06-21 03:50:00
是这样的,在ASP中,我想要两次访问数据库,我是用的AJAX在另一个页面访问的,
第一次访问时可以的,
sql_aid = "select AID, archivesid from alldocument where archivesid between '" & v_begin & "' and '" & v_end & "'"
rs.open sql_aid, conn
while not rs.eof
redim preserve arr_aid(v_count)
arr_aid(v_count)=rs("AID") & "," & rs("archivesid")
v_count=v_count+1
rs.movenext
wend
Response.Write(arr_aid(0))

但是我接着访问第二次就不行了

sql_aid = "sql1"
rs.open sql_aid, conn
while not rs.eof
redim preserve arr_aid(v_count)
arr_aid(v_count)=rs("AID") & "," & rs("archivesid")
v_count=v_count+1
rs.movenext
wend

sql_img=“sql2”
v_count=0
rs.open sql_img, conn
while not rs.eof
if rs("pagecount")=0 then
v_msg=rs("rawfilename") & rs("pagecount")
end if
redim preserve arr_img(v_count)
arr_img(v_count)=rs("rawfilename") & "," & rs("pagecount")
v_count=v_count+1
rs.movenext
wend

Response.Write(arr_aid(0))

各位大神帮我解决一下,拜谢~~~~~~~~~~
...全文
94 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
freemangod 2011-06-22
  • 打赏
  • 举报
回复
请贴出具体的错误代码。
Dogfish 2011-06-22
  • 打赏
  • 举报
回复
一楼回答了。你的rs要关闭。不然重新打开时会出错。
灬上海爽爷 2011-06-21
  • 打赏
  • 举报
回复
第一次访问以后rs.close

然后再第二次
sql2="xxxx"
rs.open sql2..........

28,409

社区成员

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

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