如何合并目标表包含主键列和源表的表不包含的表。 DataSet enforceConstraints设置为false,然后它将合并表。但是当在目标表上执行GetChanges()时发生异常。
//Dest table contains primary key which is missing in source table
DataSet ds;
DataTable source;
ds.EnforceConstraints = false;
ds.Tables["Dest"].Merge(source,true,MissingSchemaAction.AddWithKey);
ds.Tables["Dest"].GetChanges();
答案 0 :(得分:1)
尝试合并没有主键的表。 我认为这是不可能的。