public static void Main()
var table1 = new DataTable("Items");
var col1 = new DataColumn("PKey", typeof(int));
var col2 = new DataColumn("Val", typeof(int));
var col3 = new DataColumn("RowVersion", typeof(int));
table1.Columns.Add(col1);
table1.Columns.Add(col2);
table1.Columns.Add(col3);
table1.PrimaryKey = new[] { col1 };
for (var i = 0; i <= 9; i++)
var row = table1.NewRow();
var table2 = table1.Clone();
table2.Columns.Add("rowVersion", typeof(string));
for (var i = 0; i <= 9; i++)
var row = table2.NewRow();
PrintValues(table1, "table1");
PrintValues(table2, "table2");
table1.Merge(table2, false, MissingSchemaAction.Ignore);
PrintValues(table1, "table1 merged with table2");
private static void PrintValues(DataTable table, string label)
Console.WriteLine(label);
foreach (DataRow row in table.Rows)
foreach (DataColumn col in table.Columns)
Console.Write("\t " + row[col].ToString());