Troubleshooting Exceptions: System.Data.ConstraintException
Aexception is thrown when an action is attempted that violates a constraint.
- Relax or turn off constraints in your DataSets.
You can use theproperty to temporarily turn off constraints while filling tables in a object.
- Make sure you are not trying to assign a value to a primary key field where the primary key already exists in the data table.
If the primary key exists, this exception is thrown.
For more information, Visual Basic users can see.
- Clear datasets before loading them from view state.
If there is data in the dataset when you load it, this exception may be thrown.