Back to Devexpress

ConstraintViolationException Class

corelibraries-devexpress-dot-xpo-dot-db-dot-exceptions.md

latest1.7 KB
Original Source

ConstraintViolationException Class

An exception that is thrown when a key or index constraint fails.

Namespace : DevExpress.Xpo.DB.Exceptions

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
public class ConstraintViolationException :
    SqlExecutionErrorException
vb
Public Class ConstraintViolationException
    Inherits SqlExecutionErrorException

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.

Inheritance

Object Exception SqlExecutionErrorException ConstraintViolationException

See Also

ConstraintViolationException Members

DevExpress.Xpo.DB.Exceptions Namespace