为什么我的close会出错??

Oer 2003-08-25 09:07:01
我是通过调用一相函数来取得conntion
----------------conntion.asp--------------------
<%
function GetSQLRecordset(strSQL)
on error resume next
dim SQLConn
Set SQLConn = Server.CreateObject("ADODB.Connection")
SQLConn.Open "SQLConn","sa","7892010"
Set GetSQLRecordset = Server.CreateObject("ADODB.Recordset")
GetSQLRecordset.Open strSQL,SQLConn,3,2
end function
%>
---------------sghb.asp----------------
<!-- #include file="conntion.asp" -->
dim rs
set rs = GetSQLRecordset(strsql)--定义了一个strsql的语句select * from table
......
rs.close
set rs=nothing
sqlconn.close
set sqlconn=nothing
运行会出错,说 sqlconn.close有什么adorecordset错误,是什么原因??
...全文
182 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wggipkhgef 2003-09-01
  • 打赏
  • 举报
回复
set rs = GetSQLRecordset(strsql)
改为:
set rs = GetSQLRecordset
rs.open strsql,sqlconn,1,1 '原来写错了,这里是sqlconn,不是conn
或:
sqlconn.execute(strsql)
feiying_bao 2003-08-25
  • 打赏
  • 举报
回复
很简单啦:你用的两个模块,模块之间的变量不可以互访.用了<!-- #include file="conntion.asp" --> 也是一样,所以出错,其实可以不关,没有关系的,系统在程序退出是会自动关掉它.
conntion.asp dim SQLConn

sghb.asp 中没有这个变量:SQLConn

sqlconn.close系统不知道关闭一个什么东西.
Oer 2003-08-25
  • 打赏
  • 举报
回复
错误类型是什么 
错误类型:
Microsoft VBScript 运行时错误 (0x800A01A8)
/sgjl/sg1hb/sg1hbCX.asp, 第 172 行  就是sqlconn.close那一行了
Oer 2003-08-25
  • 打赏
  • 举报
回复
都不行啊,其它地方也是用到了sqlconn.close也是会出错的
wggipkhgef 2003-08-25
  • 打赏
  • 举报
回复
set rs = GetSQLRecordset(strsql)
改为:
set rs = GetSQLRecordset
rs.open strsql,conn,1,1
或:
sqlconn.execute(strsql)
业余程序员 2003-08-25
  • 打赏
  • 举报
回复
rs.close
set rs=nothing
sqlconn.close
set sqlconn=nothing
换一下位置试一下不一定能行啊!
rs.close
sqlconn.close
set rs=nothing
set sqlconn=nothing
pp4u 2003-08-25
  • 打赏
  • 举报
回复
你再看一下在程序里其他部分有没有用到close的地方。
ttt2 2003-08-25
  • 打赏
  • 举报
回复
sqlconn.close
set sqlconn=nothing
去掉就行了

28,390

社区成员

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

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