Copy datatable’s row to an other datatable’s row
This method perform a row copy with a few checks
public static void CopyRowToAnOther(DataRow row, DataRow anOtherRow)
{
if (row == null || row.Table == null
|| anOtherRow == null || anOtherRow.Table == null)
{
return;
}
foreach (DataColumn colunm in row.Table.Columns)
{
if (anOtherRow.Table.Columns.Contains(colunm.ColumnName)
&& !row.IsNull(colunm.ColumnName)
&& colunm.DataType == anOtherRow.Table.Columns[colunm.ColumnName].DataType)
{
anOtherRow[colunm.ColumnName] = row[colunm.ColumnName];
}
}
}




amazon coupon
15 Feb, 2010
nice read. I would love to follow you on twitter.