Reputation: 42165
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)?
Upvotes: 0
Views: 732
Reputation: 9389
If your column is actually marked as the primary key in the typed DataSet the auto generated updated statement should not be trying to update it. I would look at the designer and double check that it is actually the primary key.
Upvotes: 0
Reputation: 185683
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.
Upvotes: 2