Hi
Can any one explain about how to append a records from one data table to another data table.
In both the data table, I am having a similar columns.
thanks.
DataTable dt1 = new DataTable(); dt1.TableName = "DataTable1"; dt1.Columns.Add("Name"); dt1.Columns.Add("Age"); dt1.Columns.Add("City"); dt1.Columns.Add("Country"); dt1.Rows.Add(); dt1.Rows[0]["Name"] = "Mudassar Khan"; dt1.Rows[0]["Age"] = "27"; dt1.Rows[0]["City"] = "Mumbai"; dt1.Rows[0]["Country"] = "India"; DataTable dt2 = new DataTable(); dt2.TableName = "DataTable2"; dt2.Columns.Add("Name"); dt2.Columns.Add("Age"); dt2.Columns.Add("City"); dt2.Columns.Add("Country"); dt2.Rows.Add(); dt2.Rows[0]["Name"] = "John Smith"; dt2.Rows[0]["Age"] = "29"; dt2.Rows[0]["City"] = "Seattle"; dt2.Rows[0]["Country"] = "USA"; dt1.Merge(dt2);
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.