请解释下这段Asp关闭数据链接代码

来源:百度知道 编辑:UC知道 时间:2024/06/27 13:43:38
<%
Dim Conn
Set Conn=Server.CreateObject("Adodb.connection")
Conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source ="& Server.MapPath("db/a#a.asp")
Function Conn_Close()
If TypeName(conn)="Connection" Then
If conn.State=1 Then conn.Close
End If
Set conn=Nothing
End Function

Function DOTRequest(ParaName,ParaType)
Dim ParaValue
ParaValue=Request(ParaName)
If ParaType=1 then
If not isNumeric(ParaValue) then
Response.write "参数" & ParaName & "必须为数字型!"
Response.end
End if
Else
ParaValue=replace(ParaValue,"'","''")
End if
DOTRequest=trim(ParaValue)
End function
%>

关闭数据库代码只是这个
Function Conn_Close() '定义函数
If TypeName(conn)="Connection" Then '判断conn的类型
If conn.State=1 Then conn.Close '判断conn的状态,如果为真,那么将其关闭
End If
Set conn=Nothing '将conn清空
End Function