asp数据连接函数与关闭

asp函数

2008-10-08 10:59

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