While merging two DataSets in C# .net framework 4.0, it raised an error:
Mismatch columns in the primary key:
<target>
versus<source>
My 1st Dataset is from SQL Server of datatype Varchar
, while other is from Oracle database of datatype Varchar2
.
// SQL Server database
OrgStockMaster.PrimaryKey = new DataColumn[] { OrgStockMaster.Columns["PkID001"] };
// Oracle database
dtOracleStock.PrimaryKey = new DataColumn[] { dtOracleStock.Columns["PkID001"] };
While doing this,
dsStockMaster.Merge(StkFrmOracle);
DataSet dsDiff = dsStockMaster.GetChanges();
It raises this DataException
:
Mismatch columns in the primary key:
<target>.PkID001
versus<source>.PKID001
.