未设置对象变量或 With block 变量 急急急!!!
我在把类模块编译成DLL,而后用ASP调用时出现这样的问题,向高手请教。
工程名:Z1
类模块:A1和类模块A2
A1内容:
Private Context As ScriptingContext
Private Application As Application
Private Response As Response
Private Request As Request
Private Session As Session
Private Server As Server
Public Sub OnStartPage(PassedScriptContext As ScriptingContext)
Set Context = PassedScriptContext 'Asp运行环境对象
Set Application = Context.Application 'Asp 五大对象
Set Request = Context.Request
Set Response = Context.Response
Set Server = Context.Server
Set Session = Context.Session
End Sub
Public Function tt1()
tt1 = "这是A1中的对象"
End Function
Public Sub tt2()
Response.write "这是A1中直接写的内容"
End Sub
A2内容:
Private Context As ScriptingContext
Private Application As Application
Private Response As Response
Private Request As Request
Private Session As Session
Private Server As Server
Private c1 As New z7.a1
Public Sub OnStartPage(PassedScriptContext As ScriptingContext)
Set Context = PassedScriptContext 'Asp运行环境对象
Set Application = Context.Application 'Asp 五大对象
Set Request = Context.Request
Set Response = Context.Response
Set Server = Context.Server
Set Session = Context.Session
End Sub
Public Sub tt1()
Response.write c1.tt1
End Sub
Public Sub tt2()
c1.tt2
End Sub
使用ASP调用的代码:
<%
Set Air=server.CreateObject("z7.a2")
Air.tt2
Set Air=nothing
%>
出现错误:
z7 (0x800A005B)
未设置对象变量或 With block 变量
/Airline/2.asp, 第 3 行
估计是类A2调A1时出现的错误,我尝试用以下几种方法
1、private c1 As New z7.a1
2、private C1 as new a1
3、set c1=new a1
4、set c1 =new z7.a1
上面四种方法都不能成功,出现以上错误,请求高手指点,谢谢。
[解决办法]