Export (0) Print
Expand All

Constraint Class

Represents a constraint that can be enforced on one or more DataColumn objects.

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)

[<AbstractClass>]
type Constraint =  class end

The Constraint type exposes the following members.

  NameDescription
Protected methodSupported by the XNA FrameworkConstraintInitializes a new instance of the Constraint class.
Top

  NameDescription
Protected propertySupported by the XNA Framework_DataSetInfrastructure. Gets the DataSet to which this constraint belongs.
Public propertySupported by the XNA FrameworkConstraintNameThe name of a constraint in the ConstraintCollection.
Public propertySupported by the XNA FrameworkExtendedPropertiesGets the collection of user-defined constraint properties.
Public propertySupported by the XNA FrameworkTableGets the DataTable to which the constraint applies.
Top

  NameDescription
Protected methodSupported by the XNA FrameworkCheckStateForPropertyInfrastructure. Gets the DataSet to which this constraint belongs.
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkSetDataSetSets the constraint's DataSet.
Public methodSupported by the XNA FrameworkToStringGets the ConstraintName, if there is one, as a string. (Overrides Object.ToString().)
Top

A constraint is a rule used to maintain the integrity of the data in the DataTable. For example, when you delete a value that is used in one or more related tables, a ForeignKeyConstraint determines whether the values in the related tables are also deleted, set to null values, set to default values, or whether no action occurs. A UniqueConstraint, on the other hand, just makes sure that all values within a particular table are unique. For more information, see DataTable Constraints.

A base Constraint constructor is not used. Primary or unique key constraints are created by using the UniqueConstraint constructor, and foreign key constraints are created by using the ForeignKeyConstraint constructor.

The following example examines the collection of constraints for a DataTable and determines whether each constraint is a UniqueConstraint or a ForeignKeyConstraint. The properties of the constraint are then displayed.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

This type is safe for multithreaded read operations. You must synchronize any write operations.

Show:
© 2014 Microsoft