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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

13 Experts available now in Live!

Get 1:1 Help Now