meetjaydeep
meetjaydeep

Reputation: 1850

DataTable merge without primary key column

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

Upvotes: 1

Views: 3701

Answers (1)

meetjaydeep
meetjaydeep

Reputation: 1850

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

Upvotes: 1

Related Questions