This article is just an example, and users must use it flexibly according to their specific needs.
Example of recommending the blog ASP Component of csdn tornado. Net:
Http://blog.csdn.net/online/category/9939.aspx
Start VB6.0 and create the --> active DLL project. Click "project" --> reference and select "Microsoft Active Server Pages ".
Object Library"
And "Microsoft ActiveX Data Objects 2.1 library. Change the class module name to dcss. Change the project name.
Change to yygwy. Save the project file yygwy. VBP and class file dcss. Cls.
Write in dcss. CLS:
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
'The preceding statements are required.
'Define two public functions
Public Function rsresult (strsql as string) as recordset
Dim mycnn as connection
Dim myset as recordset
Dim strconnstring as string
'Strconnstring = "provider = sqloledb.1;
Password =; "&" User ID = sa; "&" Initial catalog = vlog; "&" Data Source = hpe60;
Connect timeout = 15"
Strconnstring = "driver = {SQL Server}; server = Yang; uid = sa; Pwd =;
Database = dcss"
'Mycnn. connectionstring = strconnstring
Mycnn. Open strconnstring
Myset. activeconnection = mycnn
Myset. Open strsql, mycnn, 3, adw.text
Set rsresult = myset
End Function
Public Function datasource () as Variant
Datasource = "driver = {SQL Server}; server = Yang; uid = sa; Pwd =; database = dcss"
End Function
Compile and generate the dcss. dll file. Register the regsvr32 path dcss. dll.
Use Visual InterDev to open the global. Asa file. Of course, you can also use it in other files.
Set dcss = server. Createobject ("yygwy. dcss ")
Oconn = dcss. datasource ()
Application ("strconn") = oconn
You can call the following on other pages:
Set objconn = server. Createobject ("ADODB. Connection ")
Objconn. open application ("strconn ")