当前位置:编程学习 > asp >>

面向对象的asp编程之五--adodb的类封装

<Script language="vbscript" runat="server">
'****************************************************************
' Script Compont Object Model
' Design for Active Server Pages
' Copyright 2004 Version 2.0
' Made by 尹曙光
' ****************************************************************
'
' ADODB的类封装
'
'*****************************************************************
'#################################################################
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
补充:asp教程,脚本编码
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,