'Sending log message to the WhatsUp Event Viewer Context.LogMessage "Checking Address=" & Context.GetProperty("Address") 'Set the result code of the check (0=Success, 1=Error) Context.SetResult 0, "No error" Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adUseClient = 3 Set objConnection = CreateObject("ADODB.Connection") Set objRecordset = CreateObject("ADODB.Recordset") objConnection.ConnectionString = "Driver={SQL Server};" & _ "Server=SQLSERVER;" & _ "Database=DBName;" & _ "uid=username ;"&_ "pwd=password;" objConnection.Open objRecordset.CursorLocation = adUseClient objRecordset.Open "SELECT * FROM TableName" , objConnection 'adOpenStatic, adLockOptimistic If objRecordset.recordcount < 1 Then 'Set the result code of the check (0=Success, 1=Error) Context.SetResult 1, "Error" Context.LogMessage "Checking Address=" & Context.GetProperty("Address") End If objRecordset.Close objConnection.Close set objRecordset=nothing set objConnection=nothing