Dim connbbs,conngbook,connmail,connnews,connphoto,connuser
Dim statbbs,statgbook,statmail,statnews,statphoto,statuser
Dim connstring,sql,rsbbs,rsgbook,rsmail,rsnews,rsphoto,rsuser
statuser=0 '数据库状态初始化
statbbs=0
statmail=0
statgbook=0
statphoto=0
statnews=0
'################################################################
'打开数据库过程,新的数据库按照格式添加
'################################################################
Sub OpenDB(dbname)
Select Case LCase(dbname)
Case "user"
If statuser=0 Then
Set connuser=server.CreateObject("adodb.connection")
connuser.open connstring & "/db_user.mdb"
End If
statuser=statuser+1
Case "bbs"
If statbbs=0 Then
Set connbbs=server.CreateObject("adodb.connection")
connbbs.open connstring & "/db_bbs.asp"
End If
statbbs=statbbs+1
Case "mail"
If statmail=0 Then
Set connmail=server.CreateObject("adodb.connection")
connmail.open connstring & "/db_mail.mdb"
End If
statmail=statmail+1
Case "gbook"
If statgbook=0 Then
Set conngbook=server.CreateObject("adodb.connection")
conngbook.open connstring & "/db_gbook.mdb"
End If
statgbook=statgbook+1
Case "photo"
If statphoto=0 Then
Set connphoto=server.CreateObject("adodb.connection")
connphoto.open connstring & "/db_photo.mdb"
End If
statphoto=statphoto+1
End Select
End Sub
'################################################################
'关闭数据库过程
'################################################################
Sub CloseDB(dbname)
Select Case LCase(dbname)
Case "user"
If statuser=1 Then
connuser.close
Set connuser=nothing
End If
statuser=statuser-1
Case "bbs"
If statbbs=1 Then
connbbs.close
Set connbbs=nothing
End If
statbbs=statbbs-1
Case "mail"
If statmail=1 Then
connmail.close
Set connmail=nothing
End If
statmail=statmail-1
Case "gbook"
If statgbook=1 Then
conngbook.close
Set conngbook=nothing
End If
statgbook=statgbook-1
Case "photo"
If statphoto=1 Then
connphoto.close
Set connphoto=nothing
End If
statphoto=statphoto-1
Case "news"
If statnews=1 Then
connnews.close
Set connnews=nothing
End If
statnews=statnews-1
End Select
End Sub