Tuesday, September 27, 2011

Test ADO Connection using VBscript

Quick ADO connection test using VBscript...

[code]

Const dsn = "{your connection string or DSN name here}"

On Error Resume Next
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionTimeOut = 10 ' 10 second wait limit
conn.Open dsn

If err.Number = 0 Then
	wscript.echo "CONNECTION: SUCCESS"
Else
	wscript.echo "CONNECTION: FAILED"
End If

conn.Close
Set conn = Nothing
[/code]

No comments: