asp数据连接函数与关闭

作者:袖梨 2022-07-02
 代码如下 复制代码

Sub ConnectionDatabase()
 On Error Resume Next
 Set Conn = Server.CreateObject("ADODB.Connection")
 Conn.Open Connstr
 If Err Then
  Err.Clear
  Set Conn = Nothing
  Response.Write "数据库连接出错,请打开conn.asp文件检查连接字串。"
  Response.End
 End If
End Sub
Sub CloseConn()
 On Error Resume Next
 If IsObject(Conn) Then
  Conn.Close
  Set Conn = Nothing
 End If
 Set Newasp = Nothing
End Sub

相关文章

精彩推荐