【VB不在组件中使用OnStartPage和OnEndPage】 改用实现ObjectControl接口,如何改?
我用vb封装部分asp代码作为dll组件,现在网站运行有时会报错
Server 对象 错误 'ASP 0177 : 8007000e'
Server.CreateObject 失败
-------------------------------以下为封装的代码----------------------
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "code"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Dim rp As Response
Dim rq As Request
Dim ap As Application
Dim sr As Server
Dim sn As Session
Public Sub OnStartPage(MyScriptingContext As ScriptingContext)
Set rp = MyScriptingContext.Response
Set rq = MyScriptingContext.Request
Set sr = MyScriptingContext.Server
Set ap = MyScriptingContext.Application
Set sn = MyScriptingContext.Session
End Sub
Public Sub OnEndPage()
Set rp = Nothing
Set rq = Nothing
Set sr = Nothing
Set ap = Nothing
Set sn = Nothing
End Sub
Function ConnectDB() As Variant
ConnectDB = "driver={Microsoft Access Driver (*.mdb)};uid=;pwd=123456;DBQ="
End Function
Public Function DBPath(db) As Variant
DBPath = sr.MapPath(db)
End Function
论坛中有帖子称:
VB不在组件中使用OnStartPage和OnEndPage
改用实现ObjectControl接口,如何改?请高手赐教!
这是那一篇帖子的网址,http://topic.csdn.net/u/20090923/10/bba68fb7-2bc5-4d45-9316-0ff12ea759e9.html
[解决办法]
《COM与COM+从入门到精通》中有关于ObjectControl接口的介绍。
[解决办法]
我也需要这个哦
[解决办法]
可以的啊。我一直这样写的,只是对象是在模块里定义的全局的。