I have always plagued my problem, how to determine if the database connection is successful (such as SQL is not started, the database does not exist), but the friendly error handling, but the error handling mechanism of VBScript is too bad, only on Error Resume Nex / Go To But after using ADO's wrong trap, wait for you will be a script timeout, this function will change this situation (connection timeout long can be controlled according to actual situation)
'Entry parameters: connection string strConn
'Return Value: TestConnection = True, False
Function TestConnection (STRCONN)
ON Error ResMe next
Set conn = server.createObject ("adoDb.connection")
'Setting the connection timeout is 10 seconds
Conn.connectionTIMEOUT = 10
Conn.open straconn
IF conve.errors.count = 0 THEN
TestConnection = TRUE
Conn.close
Else
TestConnection = FALSE
END IF
Set conn = Nothing
END FUNCTION