ARTICLE AD BOX
I have an interesting problem. I am trying to use the DataTable.Merge method - and running into a situation where it does not work.
I import two Excel spreadsheets into two DataTables - but I also change two columns in each imported table (the primary key for the data) - from double to Int32 while importing. I do this by creating a new column of Int32 - move the data into that column, delete the old column - and give the new Int32 column the name of the old column.
Here are the two original results in a grid... The one on the left contains a list of Personal Titles. The one on the Right contains the descriptions of those titles. You can see the Master ID and Sub Id fields are the keys to these tables.


When I try to merge the tables I get some very bad results. In the screen capture below - you can see how it has not merged the data properly. It has overwritten Master ID 1 with Master Id 12 from the second data table - and none of the Description values have been populated.

Now - if I take those data tables and save them out to XML (WriteXML method) - and import them - then run the same merge routine - I get what I would expect. from the merge method!!

So - my question is why is this happening?? It would seem that changing the field type is causing me some issues - and I cannot see why? Is there something else I need to change before I run the Merge method on the data tables?? Anyone out there run into something like this with Data Tables and the Merge (or other) method??
Explore related questions
See similar questions with these tags.
