I have a typed dataset, and where I call TableAdapter.Update(DataRow)
, the SQL executed includes an update of the primary key column of the database.
Unfortunately, when this code runs on a replicated database, the PK column has the rowguid
property set, and I get the following error:
System.Data.SqlClient.SqlException: Updating columns with the rowguidcol property is not allowed. The transaction ended in the trigger. The batch has been aborted. at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) at System.Data.Common.DbDataA...
How do I prevent the tableadapter from updating this column (the value is the same)?
You can manually edit the SQL created for the update command in the DataSet
designer Just click on the adapter and find the UpdateCommand
. Is there a reason that you're updating the primary key? If not (and you shouldn't be, if at all possible), then you should remove that from the command.