Update a column in one DataTable based on second DataTable

I’m taking the contents of an Excel Worksheet and placing it into a Datatable. One of the steps needed is to replace a country name with its 2 char abbreviation. I have a text file with the CountryName and the abbreviation that I load into a 2nd datatable. I
had thought about using a datarelation but there will be times that there won’t be an exact match but I need to keep the original country name for steps later in the project.

There isn’t any updating databases or viewing the data. This is a conversion application that takes an Excel worksheet and outputs a text file with very specific requirements, ie order, column widths, delimters, etc.

And that’s where I’m stuck. I can’t figure out how do I replace the country name efficiently. What I need is something that will simulate what an SQL Update query does.

Although I’m using datasets I am open to using anything that will work.




Hello Andy,How about storing the CountryName and Abbreviation into a HashTable and performing the lookup that way. The Hashtable should allow quick retrieval of the name of the country  and value of the abbreviation.