SillyMS


I would like to continue processing when a connect error occurs.

Set oServer = CreateObject("SQLDmo.SqlServer")
oServer.LoginSecure = True
oServer.Connect oName

Would like to continue if the connect fails rather than have the script fail. How do I do that

Thanks!




Re: How to capture error upon connect error?

Allen White


Add a Try-Catch construct to your code:

Try
oServer = CreateObject("SQLDmo.SqlServer")
oServer.LoginSecure = True
oServer.Connect(oName)
Catch ex As Exception
MsgBox(ex.Message)
End Try