Answers for "failed to enable constraints. one or more rows contain values violating non-null, unique, or foreign-key constraints"

0

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

This problem is usually caused by one of the following

null values being returned for columns not set to AllowDBNull
duplicate rows being returned with the same primary key.
a mismatch in column definition (e.g. size of char fields) between the database and the dataset
Try running your query natively and look at the results, if the resultset is not too large. If you've eliminated null values, then my guess is that the primary key columns is being duplicated.
Posted by: Guest on April-15-2022

Code answers related to "failed to enable constraints. one or more rows contain values violating non-null, unique, or foreign-key constraints"

Browse Popular Code Answers by Language