ConstraintViolationException Class
An exception that is thrown when a key or index constraint fails.
Namespace: DevExpress.Xpo.DB.Exceptions
Assembly: DevExpress.Data.v18.1.dll
Declaration
Remarks
This exception is thrown whenever an SQL statement being executed violates any of the following:
- Primary key constraints.
- Foreign key constraints.
- Unique index constraints.
Solution:
- Ensure that the SQL statement provides unique key or index values. See the exception’s SqlExecutionErrorException.Sql and SqlExecutionErrorException.Parameters parameter descriptions for additional information about the erroneous SQL statement.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ConstraintViolationException class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.