Syncing separate columns problem with allow nulls RRS feed

  • Question

  • Hi all,

    I am trying to sync a definite set of columns in the scope. However on the destination side some of the columns that do not participate in sync do NOT allow nulls. We are not able to change the database structure on the destination side. As a result we get an exception while syncing, like 

    Cannot insert the value NULL into column 'ColumnName', table 'TableName'; column does not allow nulls. INSERT fails.

    Is there a delicate way to workaround?


    Many thanks!



    Tuesday, November 29, 2011 7:58 PM

All replies

  • if the columns dont allow nulls, what do you want Sync Framework to insert for those columns? a predefined value?
    Tuesday, November 29, 2011 11:36 PM
  • Yes, it would be nice if columns got populated with default values. Unfortunately, we can't modify default values in the destination side. Maybe we can handle this situation with the framework gracefully?
    Wednesday, November 30, 2011 7:03 AM
  • you can try intercepting the change dataset and adding the default value to the null columns.

    have a look at this: http://jtabadero.wordpress.com/2011/03/07/manipulating-the-change-dataset-in-sync-fx/

    Wednesday, November 30, 2011 1:13 PM
  • June, thank you for the respond.

    However, i think it would require something more. I tried to subscribe to the different event handlers, but the problem is that the dataset contains only the columns provisioned, other columns that require default value are not in the scope.

    We currently stick to the solution to provide these default values in the insert and insertbulk procedures.

    Thursday, December 1, 2011 8:33 AM
  • you can dynamically add a column to the datatable if you want. but modifying the stored procs should work as well.
    Thursday, December 1, 2011 10:03 AM