日期:2009-10-16 浏览次数:20878 次
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 Function datasource() As Variant
datasource = "driver={sql server};server=yang;uid=sa;pwd=; database=dCSS"
End Function
编译生成dCSS.dll文件。注册regsvr32 路径\dCSS.dll。
用visual interdev打开global.asa文件.当然了,你也可以在其它文件中使用。
set dCSS=server.CreateObject("yygwy.dCSS")
oconn=dCSS.datasource()
application("strconn")=oconn
在其它的页面中如下调用即可:
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open application("strconn")