在 VB 6.0中建立一个 ActiveX dll工程(设置工程名: Example,类名: GerRec)。在菜单中选择“工程”,然后选择引用“ Microsoft Active Server Pages Object Library”和“ Microsoft ActiveX Data Object 2.0 Library”。输入如下代码:
Private MyScriptingContext As ScriptingContext
Private MyApplication As Application
Private MyRequest As Request
Private MyResponse As Response
Private MyServer As Server
Private MySession As Session
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set MyScriptingContext = PassedScriptingContext
Set MyApplication = MyScriptingContext.Application
Set MyRequest = MyScriptingContext.Request
Set MyResponse = MyScriptingContext.Response
Set MyServer = MyScriptingContext.Server
Set MySession = MyScriptingContext.Session
End Sub
Public Sub OnEndPage()
Set MyScriptingContext = Nothing
Set MyApplication = Nothing
Set MyRequest = Nothing
Set MyResponse = Nothing
Set MyServer = Nothing
Set MySession = Nothing
End Sub
Public Sub SayTitle(strTitle as string)
MyResponse.Write strTitle
......
End Sub
Public Function GetRecSqlOleDb(strSql As String) As Recordset