Option Explicit'VB ActiveX DLL Class Module Code '' ----- Reference Some settings in ASP ------ Private ScriptingContext as asptypelibrary.scriptingContextPrivate Server As ASPTYPELIBRARY.SERVER
'The following two routines are required Public Sub OnStartPage (PassedScriptingcontext As ScriptingContext) Set ScriptingContext = PassedScriptingcontext Set Server = ScriptingContext.ServerEnd SubPublic Sub OnEndPage ()' to remove all references Set ScriptingContext = Nothing Set Server = NothingEnd Sub
'If you use SQL database, you can, otherwise you want to reference asp.dll Microsoft Active Server Pages Object Library
'To quote Microsoft ActiveX Data Objects 2.8 LibraryPublic Function ConnS () As ADODB.ConnectionDim Con As ADODB.ConnectionSet Con = New ADODB.Connection'ACCESSCon.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" & Server. Mappath ("# webdb.mdb") 'sql'con.open "provider = SQLOLDB; user ID = sa; password = 123456; initial catalog = bbs; data source = 192.168.0.100;" SET Conns = Conset Con = Nothingend Function
'ASP's write method DIM CONN, Conn, Conn = Server.createObject ("AdoDb.Connection") set con = Server.createObject ("Engineer Name. Class Module Name") SET CONN = ConNCONNS
In 'ASP, you can use such as RS.Open "Select * from [Table], CONN, 1, 1, Conn.excute (" Select * from [Table] ", if you need to modify VB code is as follows Public Function ConnS (ByVal dbFile as String) as ADODB.ConnectionDim Con as ADODB.ConnectionSet Con = New ADODB.Connection'ACCESSCon.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" & DbFileSet ConnS = ConSet Con = Nothingend Function