Ambiguous ConstraintException

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

I am doing a pretty basic Fill() call to a SqlDataAdapter
filling a DataTable. The Fill() call throws a
ConstraintException, but the message is extremely
ambiguous. I get the ever-cryptic message, "Failed to
enable constraints. One or more rows contain values
violating non-null, unique, or foreign-key constraints."

Does anyone know where to begin debugging such a problem
with over 300 columns? I wish it would provide more useful
information such as which constraint and what value
violated it.
 
Hi Ken,

I'm sorry that I misunderstood your problem.

It's very hard to give you a solid resolution of debugging such a problem.
However, you can try the following ways:

1. Please check your SQL statement in the Query Analyzer to see if it works
well.

2. Please check if you have made any changes after you new DataTable? If
you made some changes to the DataTable, please check the schema of it
before the Fill() executes when debugging to see if there's any difference
between the database table and the DataTable schema.

I'll do further research on your problem and will update you when I get any
useful information.

If there's anything unclear, please feel free to reply to the post.

Kevin Yu

=======

"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top