Solved

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Posted on 2010-09-15
5
834 Views
Last Modified: 2012-05-10
Using Visual Studio with MySQL.

In my XSD dataset I created a query. It runs perfect. I can preview the data fine.

In my BLL I wrote code (see below) to retrieve the query results and I'm getting...
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Why would previewing the data work but in code it fails?

Any ideas?
Using db As New dsDemoTableAdapters.DemoTableAdapter
     Dim dt As New DataTable
     dt = db.GetDemo(DemoId) ' ERROR HAPPENS HERE

Open in new window

0
Comment
Question by:RobertNZana
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:puru1981
ID: 33684937
are you using same id to for query and preview?

if not then please check if the query is returning null on some fields in join or duplicate data.
0
 
LVL 9

Author Comment

by:RobertNZana
ID: 33684972
the param (DemoId) is the exact same

i can literally see the data results when i preview the query in the xsd dataset
0
 
LVL 9

Expert Comment

by:puru1981
ID: 33685168
this is strange...i don't see any reason for this...
0
 
LVL 9

Author Comment

by:RobertNZana
ID: 33685327
exactly
0
 
LVL 9

Accepted Solution

by:
RobertNZana earned 0 total points
ID: 33720730
couldnt figure it out
0

Featured Post

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

Suggested Solutions

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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
A short film showing how OnPage and Connectwise integration works.

932 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now