DataSet merging issues RRS feed

  • Question

  • Hi! I've got a question about merging datasets. Here's the scenario:


    I'm using the GetChanges function to create a 'temp' dataset. This dataset is passed to some business logic which alters the set and places some new data into existing rows.


    When the business logic is finished, I would like to merge back the results into the original dataset, I do this using the Merge function of the DataSet itself.



    Now the problem arises on merging back the 'result' dataset into the original one. The dataset has two (relevant) tables; one carrying orderheads and one with orderrows. The user starts with a new order to which a number of orderrows are added. If the user doesn't alter the orderhead itself (he may add orderrows) before executing the function, all is well. But when the user alters the orderhead, adds some rows and then executes the function: the changes made to the orderheads aren't merged back into the dataset. The strange thing is that the merge DOES merge back all changes made to the orderlines, but it DOESN'T merge the orderhead. And again: when the user doesn't change the head before executing: the merge is done perfectly.


    I've checked the rowstate of the lines before and after merging, they're always 'Added'. In what way could the changed orderhead be causing the changes not be merged back? I can't just go calling AcceptChanges on the rows because that way the business logic is confused which rows were added/updated/deleted (since another part of the business logic handles saving the entire set to the database).


    I've also tried the preserveChanges parameter of the Merge function, but setting that to true or false doesn't really matter much.



    I hope this is clear enough for u guys to provide me with a possible cause, if not: please ask so I can clarify Smile

    Friday, April 4, 2008 5:50 PM