Hi, Einar,
I use a stored proc, but I do it all in one round trip. Let's say I have a stored proc for adding/updating a simple name table.
I'll pass the values as parms.....@NamePK int = null, @FirstName, @LastName
If the @NamePK was not passed ("insert mode"), I'll issue an insert statement, and then do a scope_identity to get the value of the PK that was assigned.
IF the @NamePK was passed, I'll issue an update statement based on the @NamePK.
Hope that helps...
Kevin