Solved

How to merge only the missing rows

Posted on 2011-09-13
1
356 Views
Last Modified: 2012-06-22
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

0
Comment
Question by:Simbios
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
Norush earned 500 total points
ID: 36535246
Try merging with:

vwBusPark.Except(dataSet.BusinessPark, DataRowComparer<YourRow>.Default)
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question