How to merge only the missing rows
I have this code.
However I got an exception in the merge line:
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
I would like a simple way, that it merges the missing rows only, if there are rows that already exist, it shouldn't tr开发者_C百科y to copy them
Thanks
// Init
UC010_WizardStepBusinessParkDataSet dataSet = new UC010_WizardStepBusinessParkDataSet();
View_BuildingModule_UC010_BusinessPark_Wizard_GetBusinessParkData vwBusPark = new View_BuildingModule_UC010_BusinessPark_Wizard_GetBusinessParkData();
View_BuildingModule_UC010_BusinessPark_Wizard_GetBusinessParkPortfolioManagerData vwBusParkPortfolioMngr = new View_BuildingModule_UC010_BusinessPark_Wizard_GetBusinessParkPortfolioManagerData();
vwBusPark.Where.BusinessParkID.Value = businessParkID;
vwBusParkPortfolioMngr.Where.BusinessParkID.Value = businessParkID;
if (vwBusPark.Query.Load())
dataSet.BusinessPark.Merge(vwBusPark.toDataTable(), true, System.Data.MissingSchemaAction.Ignore);
Try merging with
vwBusPark.Except(dataSet.BusinessPark, DataRowComparer<YourRow>.Default)
精彩评论