asp 数据库连接与关闭程序

作者:袖梨 2022-06-30

Public Function DbOpen()
  If IsObject(Conn) Then Exit Function
  Set Conn = Server.CreateObject(Cfg.nConnectionObject)
  If Conn.State = 1 Then Exit Function
  On Error Resume Next
  Conn.Open ConnStr
  If Err.Number Then
   ErrorInfo = Err.Description
   Err.Clear
   Set Conn = Nothing
   Response.Write "

"& Cfg.sysVersion &"执行错误("& Now() &") javascript教程:history.back();"">返回 重试

错误源:
数据库连接错误
错误描述:
" & ErrorInfo & ""
   Response.Write "
"
   Response.End()
  End If
    End Function
 
    Public Function DbClose()
  If Not IsObject(Conn) Then Exit Function
  If Conn.State = 0 Then Exit Function
  Conn.Close:Set Conn = Nothing
 End Function

    '函数:创建数据库RecordSet对象
    '参数:链接串
    Public Function RecordSet(obj)
        Set obj = Server.CreateObject(Cfg.nRecordSetObject)
    End Function

相关文章

精彩推荐