Public sub SerCK()
On Error GoTo LinkErr
Dim CN As New ADODB.Connection
CN.ConnectionString = "DRIVER=SQL SERVER;SERVER=192.168.2.2;UID=abc; PWD=000;DATABASE=test"
CN.Open
CN.Execute ("UPDATE ........")
CN.Close
Set CN = Nothing
LinkExit:
Exit sub
LinkErr:
MsgBox Err.Number & " " & Err.Description
Resume LinkExit
End Function
Public Sub A123()
Dim CN As New ADODB.Connection
CN.ConnectionString = "DRIVER=SQL SERVER;SERVER=192.168.2.2;UID=abc; PWD=000;DATABASE=test"
CN.ConnectionTimeout = 2
CN.Open
CN.Close
Set CN = Nothing
End Sub