If I have a dgv with some rows being new requiring an Insert query and some requiring an update and others requiring deletion

Is it possible to use insert, update and delete commands all in the same code? How could this be done?