Link to home
Start Free TrialLog in
Avatar of Simbios
SimbiosFlag for Afghanistan

asked on

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
I would like a simple way, that it merges the missing rows only, if there are rows that already exist, it shouldn't try to copy them

Thanks


public UC010_WizardStepBusinessParkDataSet GetBusinessParkData(Int32 businessParkID)
        {
            // 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);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Norush
Norush
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial