A Visual Basic example on how to update a record if it exists or insert it if it doesn’t.
Sub RecordStandardizedComputer(WS As String) Dim txt1 As String, txt2 As String, txt3 As String Dim xSQL As String txt3 = "SELECT ComputerID from LOG_ComputersStandardized" _ & " where ComputerName = " & WS txt2 = "INSERT INTO LOG_ComputersStandardized (ComputerName, RunTime)" _ & "VALUES (" & WS & "','" & Now.ToString & "')" txt1 = "UPDATE LOG_ComputersStandardized SET " _ & " DateTime = '" & Now.ToString & "'" _ & " WHERE ComputerName = '" & WS & "'" xSQL = "IF NOT EXISTS (" & txt3 & ")" & txt2 & " ELSE " & txt1 ExecuteSqlCommand(xSQL) End Sub