Failed to enable constraints.

  • Thread starter Thread starter Bryce
  • Start date Start date
B

Bryce

I have googled and see this is a common issue, but for some reason I
can't figure this out.

I have a typed dataset, and have created a Query called "GetDataById(@id)"

I call it like this:

VerificationForm.VerificationFormDataTable table =
VerificationTableAdapter.GetDataById(id);

(where VerificationTableAdapter is a property defined like this:

protected VerificationFormTableAdapter VerificationTableAdapter
{
get
{
if (verificationTableAdapter == null)
{
verificationTableAdapter = new
VerificationFormTableAdapter();
}

return verificationTableAdapter;
}
}

On the GetDataById method, I'm getting the following error:
System.Data.ConstraintException was unhandled by user code
Message="Failed to enable constraints. One or more rows contain
values violating non-null, unique, or foreign-key constraints."
Source="System.Data"

I have right clicked on the query and did a preview data, and it
executed successfully. Not sure what else to do to troubleshoot it.

Thanks
 
Never mind. Figured it out.

Most google results mentioned that it can happen if the underlying
database changed. I think it had for me, so I recreated the dataset and
it worked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top