开发者

DataTable merge without primary key column

开发者 https://www.devze.com 2023-02-26 23:31 出处:网络
How to merge tables in which destination table contains primary key column and source table doesnt contain. DataSet enforceConstraints is set to false then it will merge the table. but when execute Ge

How to merge tables in which destination table contains primary key column and source table doesnt contain. DataSet enforceConstraints is set to false then it will merge the table. but when execute GetChanges() on destination table exception occurs.

//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();


Have tried to merge tables without primary key. I think its not possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消