'BestOI服务器端组件
'HelloWorldLite版本
'Script Written By Multiple
'Last Edited On 1st, Feb 2007
Dim Application As Application
Dim Request As Request
Dim Response As Response
Dim Server As Server
Dim Conn As Connection '数据库连接
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Dim ScriptingContext As ScriptingContext
Set ScriptingContext = PassedScriptingContext
Set Application = ScriptingContext.Application
Set Request = ScriptingContext.Request
Set Response = ScriptingContext.Response
Set Server = ScriptingContext.Server
Set ScriptingContext = Nothing
End Sub
Public Sub OnEndPage()
Set Application = Nothing
Set Request = Nothing
Set Response = Nothing
Set Server = Nothing
End Sub
Property Let db(dbPath As String)
Set Conn = GetConn(dbPath, Response)
End Property
Public Sub Init()
'初始化代码
End Sub
Public Sub ShowHelloWorld()
End Sub
上面的是VB中代码,存成类文件,记得注册组件
ASP中引用方法是
Dim BestOIobj
Set BestOIobj=Server.CreateObject("BestOI.HelloWorld")
' BestOI是工程名,HelloWorld是类名。
BestOIobj.ShowHelloWorld
db、Init、ShowHelloWorld是自定义的属性、方法
在Set那行会(自动)执行OnStartPage方法
页面结束时会(自动)执行OnEndPage方法。