StrataFrame Forum

Problem Updating with Merge Replication

http://forum.strataframe.net/Topic1154.aspx

By Paul Chase - 5/9/2006

I have set up Merge Replication in Sql 2005. I am able to inset a record without any issues however when I update I get the following error. I am using a guid coluumn as my PK. Any Ideas? 

BusinessLayerException
 An error occurred while saving an the data to the server.
DataLayerSavingException
 Updating columns with the rowguidcol property is not allowed.
The transaction ended in the trigger. The batch has been aborted.
SqlException
 Updating columns with the rowguidcol property is not allowed.
The transaction ended in the trigger. The batch has been aborted.

Source     : MicroFour StrataFrame Business

Stack Trace:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
   at MicroFour.StrataFrame.Data.SqlDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler, Boolean RecreateCommand)
   at MicroFour.StrataFrame.Data.DbDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler)
   at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)
   at MicroFour.StrataFrame.Data.DataLayer.SaveByForm(DataTable TableToSave, Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save()
   at MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdSave_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

By StrataFrame Team - 5/9/2006

Does the table have another guid that the replication is using for synchronization, or is the pk column the guid column that is being used for replication?
By Paul Chase - 5/9/2006

The Pk column.I figured since I needed it for replication why not use it as a PK
By Paul Chase - 5/9/2006

The error comes from the update statement containing the guid field, this makes sense as you would not want this be able to change as it would really mess up replication.

 For instance Update mytable set guidfld = 'whatever it was' , datafld = 1 where guidfld = 'whateverit was'  would fail however,  update mytable set  datafld = 1 where guidfld = 'whateverit was'  would be ok .

What would be the best way to handle this from Strataframe?

By StrataFrame Team - 5/9/2006

Well, right now, guid pks are configured to allow you to change their values, hence why we have parameters for PK and PK_ORG (_ORG for "original").  I'll looking at modifying the business objects to allow you to exclude fields from the updates (we some more users that need the same functionality), which won't be a drastic change, and will likely be included with the update next week (when we release the DevExpress wrapper, BOMapper changes, etc.).
By Paul Chase - 5/9/2006

Thanks Ben
By StrataFrame Team - 5/9/2006

No problem, Paul.
By Paul Chase - 5/31/2006

Ben,

Were you able to include this change into the latest build?

thanks

Paul