用VB写组件,asp调用出错
创建activex dll名称为first,模块名称为test代码: '对象的声明
Dim rp As Response
Dim rq As Request
Dim ap As Application
Dim sr As Server
Dim sn As Session '当组件被创建的时候会触发这个事件
Public Sub OnStartPage(mysc As ScriptingContext)
'进行对象的实例化
Set rp = mysc.Response
Set rq = mysc.Request
Set sr = mysc.Server
Set ap = mysc.Application
Set sn = mysc.Session
rp.Write "<br>ActiveX DLL组件已经被创建了!<br>"
End Sub '当组件被销毁的时候触发这个事件
Public Sub OnEndPage()
rp.Write "<br>ActiveX DLL组件已经被销毁!<br>"
'销毁对象
Set rp = Nothing
Set rq = Nothing
Set sr = Nothing
Set ap = Nothing
Set sn = Nothing
End Sub '定义我们自己的一个组件方法
Public Sub HelloWorld()
rp.Write "<H1>Hello,World!</H1>"
End Sub注册first.dll成功
regsvr32 d:\first.dll调用
<%
dim testme
set testme=server.createobject("first.test")
testme.HelloWorld
set testme=nothing
%> 出现如下错误:Microsoft VBScript 编译器错误 错误 '800a03f6' 缺少 'End' /iisHelp/common/500-100.asp,行242 Microsoft VBScript 编译器错误 错误 '800a0408' 无效字符 /com/index.asp,行2 set testme=server.createobject("first.test")
^
创建activex dll名称为first,模块名称为test代码: '对象的声明
Dim rp As Response
Dim rq As Request
Dim ap As Application
Dim sr As Server
Dim sn As Session '当组件被创建的时候会触发这个事件
Public Sub OnStartPage(mysc As ScriptingContext)
'进行对象的实例化
Set rp = mysc.Response
Set rq = mysc.Request
Set sr = mysc.Server
Set ap = mysc.Application
Set sn = mysc.Session
rp.Write "<br>ActiveX DLL组件已经被创建了!<br>"
End Sub '当组件被销毁的时候触发这个事件
Public Sub OnEndPage()
rp.Write "<br>ActiveX DLL组件已经被销毁!<br>"
'销毁对象
Set rp = Nothing
Set rq = Nothing
Set sr = Nothing
Set ap = Nothing
Set sn = Nothing
End Sub '定义我们自己的一个组件方法
Public Sub HelloWorld()
rp.Write "<H1>Hello,World!</H1>"
End Sub注册first.dll成功
regsvr32 d:\first.dll调用
<%
dim testme
set testme=server.createobject("first.test")
testme.HelloWorld
set testme=nothing
%> 出现如下错误:Microsoft VBScript 编译器错误 错误 '800a03f6' 缺少 'End' /iisHelp/common/500-100.asp,行242 Microsoft VBScript 编译器错误 错误 '800a0408' 无效字符 /com/index.asp,行2 set testme=server.createobject("first.test")
^
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货