ForeignKeyConstraint.DeleteRule プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ForeignKeyConstraint.DeleteRule プロパティの意味・解説 

ForeignKeyConstraint.DeleteRule プロパティ

行を削除したときにこの制約全体発生するアクション取得または設定します

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Overridable Property
 DeleteRule As Rule
Dim instance As ForeignKeyConstraint
Dim value As Rule

value = instance.DeleteRule

instance.DeleteRule = value
public virtual Rule DeleteRule { get; set;
 }
/** @property */
public Rule get_DeleteRule ()

/** @property */
public void set_DeleteRule (Rule value)
public function get DeleteRule
 () : Rule

public function set DeleteRule
 (value : Rule)

プロパティ
Rule 値の 1 つ既定値Cascade です。

解説解説

テーブルら行削除すると、DeleteRule によって、子テーブルの列で実行されるアクション決定されます。規則Cascade設定されている場合、子行が削除されます。

SetNull に設定されている場合は、影響がある行の適切な列に DBnull が格納されます。データ ソースによって、列に null 値格納できるかどうか異なります。たとえば、SQLServer では null 値一意ではなくても、複数null 値主キー列に格納できます。しかし、DataTable では、DataColumn オブジェクトUnique プロパティtrue設定されている場合は、主キー列に複数null 値格納できません。

規則が SetDefault に設定されている場合は、列の既定値割り当てられます。

使用例使用例

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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ForeignKeyConstraint クラス
ForeignKeyConstraint メンバ
System.Data 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からForeignKeyConstraint.DeleteRule プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からForeignKeyConstraint.DeleteRule プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からForeignKeyConstraint.DeleteRule プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ForeignKeyConstraint.DeleteRule プロパティ」の関連用語

ForeignKeyConstraint.DeleteRule プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ForeignKeyConstraint.DeleteRule プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS