다음을 통해 공유


ForeignKeyConstraint.UpdateRule 속성

행이 업데이트될 때 이 제약 조건에 발생하는 동작을 가져오거나 설정합니다.

네임스페이스: System.Data
어셈블리: System.Data(system.data.dll)

구문

‘선언
Public Overridable Property UpdateRule As Rule
‘사용 방법
Dim instance As ForeignKeyConstraint
Dim value As Rule

value = instance.UpdateRule

instance.UpdateRule = value
public virtual Rule UpdateRule { get; set; }
public:
virtual property Rule UpdateRule {
    Rule get ();
    void set (Rule value);
}
/** @property */
public Rule get_UpdateRule ()

/** @property */
public void set_UpdateRule (Rule value)
public function get UpdateRule () : Rule

public function set UpdateRule (value : Rule)

속성 값

Rule 값 중 하나입니다. 기본값은 Cascade입니다.

예제

다음 예제에서는 ForeignKeyConstraint를 만들고 다양한 속성을 설정한 다음 이것을 DataTable 개체의 ConstraintCollection에 추가합니다.

' 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 fkConstraint As ForeignKeyConstraint

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

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

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

플랫폼

Windows 98, Windows 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

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

ForeignKeyConstraint 클래스
ForeignKeyConstraint 멤버
System.Data 네임스페이스
ForeignKeyConstraint.AcceptRejectRule 속성
Rule