I have a DataTable with the following columns:
- id
- msisdn
- status
- another_column
And a string[2][n] array (multi dimensional):
{msisdn, status, useless_data} . . .
I need start from 0 to n in string array and search for the msisdn field in data table. And update the status column in the datatable from the string array’s status field.
In datatable msisdn is not unique. More than one column may contain sama msisdn twice or more. However in string array msisdn is unique.
What is the fastest way to match this DataTable and String array and do the stuff above?
Any ideas or help would be appreciated.
First, I would hope that your string array declaration is more like
string[n][2]rather thanstring[2][n]. For the purposes of this answer I’m going to assume that’s the case and it’s just a typo.The fastest way is likely with a
DataView, though LINQ toDataSets in .NET 3.5 may be just as good. Something like this: