I have two datatables. One is a superset of another. Both have one column StageID common. I need to merge these two tables together so that the subset datatables data gets stored in the correct row of superset table.
This is what i did to join the data after retrieving the superset data in JoinTable and subset data in DTMaterialProperties table
foreach (DataColumn dcMaterialProp in dtMaterialProperties.Columns)
{
if (dcMaterialProp.ColumnName != "StageId" &&
JoinDataTable.Columns.Contains(dcMaterialProp.ColumnName))
{
JoinDataTable.Rows[rowCount][dcMaterialProp.ColumnName] =
dtMaterialProperties.Rows[0][dcMaterialProp.ColumnName];
}
}
But this was not efficient as it takes a lot of time in looping through. Please Help me in finding a better way to do this.