Sugerir traducción
 
Otros han sugerido:

progress indicator
No hay más sugerencias.
Evaluar y enviar comentarios
Contraer todo/Expandir todo Contraer todo
Ver contenido:  en paraleloVer contenido: en paralelo
.NET Framework Class Library
Rule Enumeration

Indicates the action that occurs when a ForeignKeyConstraint is enforced.

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)
Visual Basic
Public Enumeration Rule
C#
public enum Rule
Visual C++
public enum class Rule
F#
type Rule
Member nameDescription
Supported by the XNA FrameworkNoneNo action taken on related rows.
Supported by the XNA FrameworkCascadeDelete or update related rows. This is the default.
Supported by the XNA FrameworkSetNullSet values in related rows to DBNull.
Supported by the XNA FrameworkSetDefaultSet values in related rows to the value contained in the DefaultValue property.

The Rule values are set to the UpdateRule and the DeleteRule properties of a ForeignKeyConstraint object found in a DataTable object's ConstraintCollection.

The Rule values determine the action that occurs when a value in a column is either deleted or updated. Of the two, deleting a value is the more critical and demanding of attention when setting a rule.

In the case where a value is deleted, Cascade specifies that all rows containing that value are also deleted. SetNull specifies that values in all child columns are set to null values. SetDefault specifies that all child columns be set to the default value for the column. None specifies that no action will occur, but exceptions are generated.

In the case where a value is updated, Cascade specifies that all child columns are likewise updated with the new value. SetNull specifies that all child columns be set to null values. SetDefault specifies that all child column values be set to the default value. None specifies that no action be taken, but exceptions are generated.

Constraints on a DataSet are not enforced unless the EnforceConstraints property is true.

When the AcceptChanges method is called, the AcceptRejectRule further determines what action occurs.

Visual Basic
' The next line goes into the Declarations section of the module:
' SuppliersProducts is a class derived from DataSet.
Private suppliersProducts As SuppliersProducts

Private Sub CreateConstraint()
    ' Declare parent column and child column variables.
    Dim parentColumn As DataColumn
    Dim childColumn As DataColumn
    Dim fkeyConstraint As ForeignKeyConstraint

    ' Set parent and child column variables.
    parentColumn = suppliersProducts.Tables("Suppliers").Columns("SupplierID")
    childColumn = suppliersProducts.Tables("Products").Columns("SupplierID")
    fkeyConstraint = New ForeignKeyConstraint( _
        "SupplierFKConstraint", parentColumn, childColumn)

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

    ' Add the constraint, and set EnforceConstraints to true.
    suppliersProducts.Tables("Products").Constraints.Add(fkeyConstraint)
    suppliersProducts.EnforceConstraints = True
End Sub

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Biblioteca de clases de .NET Framework
Rule (Enumeración)

Indica la acción que se produce cuando se fuerza un ForeignKeyConstraint.

Espacio de nombres:  System.Data
Ensamblado:  System.Data (en System.Data.dll)
Visual Basic
Public Enumeration Rule
C#
public enum Rule
Visual C++
public enum class Rule
F#
type Rule
Nombre de miembroDescripción
Compatible con XNA FrameworkNoneNo realiza ninguna acción en las filas relacionadas.
Compatible con XNA FrameworkCascadeElimina o actualiza las filas relacionadas. Éste es el valor predeterminado.
Compatible con XNA FrameworkSetNullEstablece los valores de las filas relacionadas en DBNull.
Compatible con XNA FrameworkSetDefaultEstablece los valores de las filas relacionadas en el valor contenido en la propiedad DefaultValue.

Los valores de Rule se establecen en las propiedades UpdateRule y DeleteRule de un objeto ForeignKeyConstraint encontrado en un ConstraintCollection de un objeto DataTable.

Los valores de Rule determinan la acción que se produce cuando se elimina o actualiza un valor de una columna. De estas dos posibilidades, la eliminación de un valor es la más importante y la que requiere una mayor atención al establecer una regla.

En caso de que se elimine un valor, Cascade especifica que se eliminen también todas las filas que contengan ese valor. SetNull especifica que los valores de todas las columnas secundarias se establezcan en valores nulos. SetDefault especifica que todas las columnas secundarias se establezcan en el valor predeterminado de la columna. None especifica que no se realice ninguna acción, pero que se generen excepciones.

En caso de que se actualice un valor, Cascade especifica que se actualicen también todas las columnas secundarias con el nuevo valor. SetNull especifica que todas las columnas secundarias se establezcan en valores nulos. SetDefault especifica que los valores de todas las columnas secundarias se establezcan en el valor predeterminado. None especifica que no se realice ninguna acción, pero que se generen excepciones.

Las restricciones de un DataSet no se fuerzan a menos que la propiedad EnforceConstraints sea true.

Cuando se llama al método AcceptChanges, AcceptRejectRule se determina exactamente qué acción se va a producir.

Visual Basic
' The next line goes into the Declarations section of the module:
' SuppliersProducts is a class derived from DataSet.
Private suppliersProducts As SuppliersProducts

Private Sub CreateConstraint()
    ' Declare parent column and child column variables.
    Dim parentColumn As DataColumn
    Dim childColumn As DataColumn
    Dim fkeyConstraint As ForeignKeyConstraint

    ' Set parent and child column variables.
    parentColumn = suppliersProducts.Tables("Suppliers").Columns("SupplierID")
    childColumn = suppliersProducts.Tables("Products").Columns("SupplierID")
    fkeyConstraint = New ForeignKeyConstraint( _
        "SupplierFKConstraint", parentColumn, childColumn)

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

    ' Add the constraint, and set EnforceConstraints to true.
    suppliersProducts.Tables("Products").Constraints.Add(fkeyConstraint)
    suppliersProducts.EnforceConstraints = True
End Sub

.NET Framework

Compatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Compatible con: 4, 3.5 SP1

Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2

.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Contenido de la comunidad   ¿Qué es Community Content?
Agregar contenido nuevo RSS  Anotaciones
Processing
© 2012 Microsoft. Reservados todos los derechos. Términos de uso | Marcas Registradas | Privacidad
Page view tracker