Merging Datasets
-
Hi, my situation is that I am creating an updater for my application that updates a reference library in the database. I have a master library and a client library. I basically want to be able to compare the master library with the clients library and update where necessary. I could achieve this with the merge datasets, then call get changes and update the database. However what I must avoid is that the client may have made changes to their library and I don't want to override there specific changes with the master database. Any ideas how I might acomplish this? Thanks Paul
-
Hi, my situation is that I am creating an updater for my application that updates a reference library in the database. I have a master library and a client library. I basically want to be able to compare the master library with the clients library and update where necessary. I could achieve this with the merge datasets, then call get changes and update the database. However what I must avoid is that the client may have made changes to their library and I don't want to override there specific changes with the master database. Any ideas how I might acomplish this? Thanks Paul
I suggest to use an approach of your own, not the Merge method. The Merge method updates the values in the target DataSet. Why not just loop through all rows in the Master DataSet, look for a row in the CLient DataSet with same id (or something similar) and if none is found, then load the master row to the client DataSet. Methods to use: - foreach () for looping over Master DataSet - FindById(id) for searching the row in Client DataSet (assuming it's a typed DataSet with PrimaryKey id) - LoadRow(row) to load row into Client DataSet Happy Programming Urs
-^-^-^-^-^- no risk no funk
-
I suggest to use an approach of your own, not the Merge method. The Merge method updates the values in the target DataSet. Why not just loop through all rows in the Master DataSet, look for a row in the CLient DataSet with same id (or something similar) and if none is found, then load the master row to the client DataSet. Methods to use: - foreach () for looping over Master DataSet - FindById(id) for searching the row in Client DataSet (assuming it's a typed DataSet with PrimaryKey id) - LoadRow(row) to load row into Client DataSet Happy Programming Urs
-^-^-^-^-^- no risk no funk
Thanks for your reply. I think we are going to stick with our XML approach but we were wondering if an object based approach was feasible. With the XML approach we do the following: 1)Generate XML on the master database (contains updates/changes) 2)Then compare the XML with old XML generated on the last update. 3)Work through the XML and outputting where any changes are discovered. 4) The out put contains information on the row and particular field that is different 5)We can then call SQL to update the specific fields that have changed as well as insert/delete rows where appropriate. Is there any easy way to do that using objects. Or is it best to stick with the XML approach? Regards Paul