Hi

I just don't get this. If I create a DataColumnMappingCollection and then
copy it to an array when I then try to use the array like this I get error:

System.ArgumentException was unhandled Message="The DataColumnMapping is
already contained by another
DataColumnMappingCollection."

If I create the DataColumnMapping arrays manually it works. I was just using
1 item in both arrays.

DataColumnMapping[] mappings = GetColumnMappings(maps);
DataTableMapping tableMap = new DataTableMapping(null, null, mappings);

public static DataColumnMapping[] GetColumnMappings(JobRuleColumnMapping[]
mappings)
{
DataColumnMappingCollection mapColl = new DataColumnMappingCollection();
foreach (JobRuleColumnMapping map in mappings)
{
if (map.Source != null && map.Destination != null)
mapColl.Add(map.Source, map.Destination);
}
DataColumnMapping[] mapArr = new DataColumnMapping[mapColl.Count];
mapColl.CopyTo(mapArr, 0);
return mapArr;
}

Can someone please explain this?
Thanks
Andrew