This documentation is archived and is not being maintained.

AcceptRejectRule Enumeration

Determines the action that occurs when the AcceptChanges or RejectChanges method is invoked on a DataTable with a ForeignKeyConstraint.

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

Public Enumeration AcceptRejectRule
Dim instance As AcceptRejectRule

public enum AcceptRejectRule
public enum AcceptRejectRule

 Member nameDescription
Supported by the .NET Compact FrameworkCascadeChanges are cascaded across the relationship. 
Supported by the .NET Compact FrameworkNoneNo action occurs (default). 

Changes to a DataTable are not final until you call the AcceptChanges method. When either AcceptChanges or RejectChanges is called on a row in the parent table, the AcceptRejectRule value determines whether or not changes are propagated to corresponding rows in the child table.

The following example creates a ForeignKeyConstraint, sets various of its properties, including the AcceptRejectRule, and adds it to a DataTable object's ConstraintCollection.

Private Sub CreateConstraint(dataSet As DataSet, _
   table1 As String, table2 As String, _
   column1 As String, column2 As String)

   ' Declare parent column and child column variables.
   Dim parentColumn As DataColumn
   Dim childColumn As DataColumn
   Dim foreignKeyConstraint As ForeignKeyConstraint

   ' Set parent and child column variables.
   parentColumn = dataSet.Tables(table1).Columns(column1)
   childColumn = dataSet.Tables(table2).Columns(column2)
   foreignKeyConstraint = New ForeignKeyConstraint _
      ("SupplierForeignKeyConstraint", parentColumn, childColumn)

   ' Set null values when a value is deleted.
   foreignKeyConstraint.DeleteRule = Rule.SetNull
   foreignKeyConstraint.UpdateRule = Rule.Cascade
   foreignKeyConstraint.AcceptRejectRule = AcceptRejectRule.None

   ' Add the constraint, and set EnforceConstraints to true.
   dataSet.EnforceConstraints = True
End Sub

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0