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!
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
No comments:
Post a Comment