"Failed to enable constraints. One or more rows contain values violating non-nu


  •  when i execute the getData.....this error come out...."Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." the enforceContraint alredy set to false...... can anyone help? thanks

    Tuesday, April 18, 2006 1:46 AM

All replies

  • I had this problem and created a new select query in the dataset designer and added the parent table in the query builder, creating an inner join.  I named it something new ...getDataByInnerJoin and used it instead.  It worked for me.


    Wednesday, April 19, 2006 1:41 PM
  • This is annoying to the point of being a bug that I strongly believe MS needs to address.  We put all of our T-SQL statements in the DataSet Designer b/c it helps separate the database layer of the application from the logic layer and helps keep our code more "clean".  The DataSet designer is a very great thing.  However, the "failed to enable constraints" error message is getting annoying to the point we're considering not using the Designer at all anymore.  Most of the time, I recommend pulling the query that's causing the problem out of the TableAdapter and put it in it's own TableAdapter.  This solves the problem 99% of the time for us.  The problem in doing that is that you end up with 50 more table adapters than you actually need.  The other thing that works sometimes is to use both the Fill and the Get methods.  Sometimes the Get method won't work, but the Fill will, or vice versa. 

    Again, I have no good solution for this, except to put the problem query in it's own TableAdapter.  I love the Dataset Designer, but we get this message so often, it's starting to become very burdensome on our development efforts.  In addition, it is extremely slow to use.  While, I wouldn't advise not using the Designer, I can't in good faith recommend using it either.

    Sunday, May 27, 2007 1:14 AM
  • use On error resume next in the Bind data function
    Tuesday, June 19, 2007 3:14 PM