'入口参数:连接字符串strconn
'返回值:TestConnection=true,false
Function TestConnection(strconn)
On Error Resume Next
set conn=server.createobject("adodb.connection")
'这里设定连接超时为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
……