[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to merge only the missing rows

Posted on 2011-09-13
1
Medium Priority
?
367 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 2000 total points
ID: 36535246
Try merging with:

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

650 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