Simple Example Needed: Sync just one record from one table
CoastalData
Posts: 22
Hello,
I need a simple vb.net example... I just want to sync one record from one table. All of the examples I've looked at loop through all mappings conditionally setting the desired tables' include property to True, and all the others to False, but is that really neccessary?
Isn't there some simple way to say:
1. Include just this one table (without looping) and disregard all other tables
2. Filter to just this one record (id=172)
3. If the records exist in db1 and db2 then sync them.
If I set this up in Sql Data Compare 8, this works PERFECTLY. Why does this seem so difficult in the SDK?
I need a simple vb.net example... I just want to sync one record from one table. All of the examples I've looked at loop through all mappings conditionally setting the desired tables' include property to True, and all the others to False, but is that really neccessary?
Isn't there some simple way to say:
1. Include just this one table (without looping) and disregard all other tables
2. Filter to just this one record (id=172)
3. If the records exist in db1 and db2 then sync them.
If I set this up in Sql Data Compare 8, this works PERFECTLY. Why does this seem so difficult in the SDK?
Comments
Thanks for your question. I suppose you have two approaches that you can use -- one would be to create the mappings automatically, loop through all matching mappings, and set the "Included" property to false on all of them except the table or view that you want to compare.
The other mapping approach would be to manually construct a table mapping in code and then add it to a manually-constructed TableMappings collection.
To compare a subset of data, you can apply a "WhereClause" to the mapping to limit the data to the records that you want to compare and synchronize. There are many ways to filter the data in either the comparison or synchronization processes.