Object-oriented ASP programming five--ADODB class encapsulation
Source: Internet
Author: User
<script language= "VBScript" runat= "Server" >
'****************************************************************
' Script Compont Object Model
' Design for Active Server Pages
' Copyright Version 2.0
' Made by Ying Guang
' ****************************************************************
'
' ADODB class encapsulation
'
'*****************************************************************
'#################################################################
Function createcadoconnection ()
Set Createcadoconnection=new cadoconnection
End Function
Class cadoconnection
Public objadoconnection
'===============================================================
Public Property Get ConnectionString
Connectionstring=objadoconnection.connectionstring
End Property
Public Property Let ConnectionString (ByVal connstring)
Objadoconnection.connectionstring=connstring
End Property
'===============================================================
Private Sub class_initialize ' Setup Initialize event.
On Error Resume Next
Set Objadoconnection=server.createobject ("ADODB. Connection ")
Objadoconnection.connectiontimeout = 15
Objadoconnection.commandtimeout = 30
Objadoconnection.cursorlocation = 3
End Sub
Private Sub class_terminate ' Setup Terminate event.
Closedbconn ()
Set objadoconnection=nothing
End Sub
' Open adodb.connection
Public Sub Opendbconn (dblink)
On Error Resume Next
Objadoconnection.connectionstring=dblink
OPENDBCONN2 ()
End Sub
Public Sub OpenDbConn2 ()
On Error Resume Next
Closedbconn ()
Objadoconnection.open ()
If Err.number>0 Then
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service