This function updates a row in a SQL table. There is probably a way to do it all with one query, but when I wrote it I was pretty new to SQL, and because it worked I didn’t change it.
Private Function updateRow(ByVal path As String, ByVal stringDN As String, ByVal Server As String, ByVal Volume As String, ByVal Folder As String, ByVal Status As String) As Integer
Dim modSQL As String
Dim sqlModCommand As SqlCommand
If stringDN = “NULL” Then
modSQL = “UPDATE ” & MIISSync_DB_TABLE_NAME & ” SET stringDN = NULL where path=’” & path & “‘”
Else
modSQL = “UPDATE ” & MIISSync_DB_TABLE_NAME & ” SET stringDN =’” & stringDN & “‘ where path=’” & path & “‘”
End If
sqlModCommand = New SqlCommand(modSQL, sqlExportConnection)
sqlModCommand.ExecuteNonQuery()
modSQL = “UPDATE ” & MIISSync_DB_TABLE_NAME & ” SET Server =’” & Server & “‘ where path=’” & path & “‘”
sqlModCommand = New SqlCommand(modSQL, sqlExportConnection)
sqlModCommand.ExecuteNonQuery()
modSQL = “UPDATE ” & MIISSync_DB_TABLE_NAME & ” SET Volume =’” & Volume & “‘ where path=’” & path & “‘”
sqlModCommand = New SqlCommand(modSQL, sqlExportConnection)
sqlModCommand.ExecuteNonQuery()
modSQL = “UPDATE ” & MIISSync_DB_TABLE_NAME & ” SET Folder =’” & Folder & “‘ where path=’” & path & “‘”
sqlModCommand = New SqlCommand(modSQL, sqlExportConnection)
sqlModCommand.ExecuteNonQuery()
modSQL = “UPDATE ” & MIISSync_DB_TABLE_NAME & ” SET Status =’” & Status & “‘ where path=’” & path & “‘”
sqlModCommand = New SqlCommand(modSQL, sqlExportConnection)
Return sqlModCommand.ExecuteNonQuery()
End Function