If loCurrentPk.Equals(PKValue) Then '-- Remove the current row and navigate to the next row loRow = Me.CurrentRow loRow.Delete() loRow.AcceptChanges() '-- Decrement the index and navigate Me._CurrentRowIndex -= 1 Me.Navigate(BusinessNavigationDirection.Next) Else '-- Find the row to delete If Me.SeekToPrimaryKey(PKValue) Then '-- Remove the row loRow = Me.CurrentRow loRow.Delete() loRow.AcceptChanges() '-- Move back to the original row Me.SeekToPrimaryKey(loCurrentPk) End If End If
The above command will only mark the row as deleted (the True) and not go back to the server, obviously False will go back to the server. Second, if you don't want to commit the changes, then you can call the following command:
This wasy you are staying within the logic of the BO. Even if you want to call the delete on the data table directly would be safer than passing of the row reference and the smoking it:
Any of these are going to be much safer. I recommend the first option as it remains within the BO logic.