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
836 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

816 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

11 Experts available now in Live!

Get 1:1 Help Now