Error: "Mappings only supports mapping objects."
jbaggaley
Posts: 38
What does this error mean in the context of trying to create a custom column mapping. I figure it is something to do with the primary key field because in your widget example:
On my table, I have two columns, a primary key value and a secondary key value which I want to compare them against a table that has a combination of those two as a composite primary key but get this error.
What do I need to change (in sql or my code) to fix this issue - even for the widget sample if i wanted to compare price columns for some reason?
Also, can you confirm if the following are identical because in the help file they are next to each other not a subset of eachother.
Thanks
Jon
// Create the mappings between a certain table TableMapping tableMapping = (TableMapping)mappings.Join(db1.Tables["[dbo].[WidgetPrices]"], db2.Tables["[dbo].[WidgetPrices]"]); // Set the custom comparison key for the table tableMapping.MatchingMappings.Clear(); tableMapping.MatchingMappings.Add(tableMapping.FieldMappings["WidgetID"]); tableMapping.RefreshMappingStatus(); // Set the where clause for the comparison tableMapping.Where = new WhereClause("Active = 'Y'"); // Peform the comparison session.CompareDatabases(db1, db2, mappings);changing "widgetid" to "price" produces the same error.
On my table, I have two columns, a primary key value and a secondary key value which I want to compare them against a table that has a combination of those two as a composite primary key but get this error.
What do I need to change (in sql or my code) to fix this issue - even for the widget sample if i wanted to compare price columns for some reason?
Also, can you confirm if the following are identical because in the help file they are next to each other not a subset of eachother.
TableMappings mappings = new TableMappings(); TableMapping tableMapping = (TableMapping)mappings.Join(and
SchemaMappings mappings = new SchemaMappings(); TableMapping tableMapping =(TableMapping) mappings.TableMappings.Join(Am I right in presuming that they are interchangeable?
Thanks
Jon
:-)zz[
Comments
For future reference to solve:-
make sure the field name is spelt correctly and that it is being passed as a string.
As for my other question, the tablemapping and structure.tablemappings do seem functionally identical even though they appear next to each other in the help.
Hope this helps someone....
Jon
As you found out the fields are case sensitive.
I believe that Schema mappings are probably what you want to use.
Schema mappings are a superset of TableMappings.
I would recomend that you let SQL Data Compare Engine setup the default mappings for you and then afterwards customize it for you requirements. eg
if you want to use one of the indexes then call or if you know the indexes name, you could use Hope that helps
David