直播中
'入口參數(shù):連接字符串strconn
'返回值:TestConnection=true,false
Function TestConnection(strconn)
On Error Resume Next
set conn=server.createobject("adodb.connection")
'這里設(shè)定連接超時(shí)為10秒
conn.ConnectionTimeout=10
conn.Open strconn
If conn.Errors.Count = 0 Then
TestConnection = True
conn.close
Else
TestConnection = False
End If
set conn=nothing
End Function