Microsoft VBScript 运行时错误 (0x800A01A8)
缺少对象: ''
原因是我调用函数时没有定义全局变量,开始程序是这样的.b_connect.asp文件代码如下.
sub open_bbs()
set sqlrs=server.CreateObject("adodb.recordset")
set sqlcn=server.createobject("adodb.connection")
sqlconstr="driver={sql server};server=5555555;uid=cdd3;pwd=dd0;database=cwddd3_db"
sqlcn.open sqlconstr
end sub
调用代码:
<%
B_sql ="select * from bbs_lm order by bbs_lm_order asc "
call Open_bbs()
sqlrs.open B_sql,sqlcn,1,1
do while not sqlrs.eof
%>
也现错误提示:错误类型:
Microsoft VBScript 运行时错误 (0x800A01A8)
缺少对象: ''
/gero/gero/bbs/index.asp, 第 45 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)
网页:
GET /gero/gero/bbs/index.asp
经过仔细查看,找到原因是open_bbs()
Dim sqlrs,sqlcn //加上这里就行了.
sub open_bbs()
set sqlrs=server.CreateObject("adodb.recordset")
set sqlcn=server.createobject("adodb.connection")
sqlconstr="driver={sql server};server=218.30.99.21;uid=cw58013;pwd=m9n6u3e0;database=cw58013_db"
sqlcn.open sqlconstr
end sub
=================================================