共用方式為


UniqueConstraint.Columns 屬性

定義

取得這個條件約束影響的資料行陣列。

public:
 virtual property cli::array <System::Data::DataColumn ^> ^ Columns { cli::array <System::Data::DataColumn ^> ^ get(); };
public virtual System.Data.DataColumn[] Columns { get; }
[System.Data.DataSysDescription("KeyConstraintColumnsDescr")]
public virtual System.Data.DataColumn[] Columns { get; }
member this.Columns : System.Data.DataColumn[]
[<System.Data.DataSysDescription("KeyConstraintColumnsDescr")>]
member this.Columns : System.Data.DataColumn[]
Public Overridable ReadOnly Property Columns As DataColumn()

屬性值

DataColumn 物件的陣列。

屬性

範例

下列範例會傳 DataColumn 回 限制的物件 UniqueConstraint

Private Sub GetColsFromConstraint()
    Dim dataColumns() As DataColumn

    ' Get a named relation from a DataSet.
    Dim dataRelation As DataRelation
    dataRelation = DataSet1.Relations("CustomerOrders")

    ' Get the ParentKeyConstraint
    Dim uniqueConstraint As UniqueConstraint
    uniqueConstraint= dataRelation.ParentKeyConstraint

    ' Get the DataColumn objects being constrained.
    dataColumns = uniqueConstraint.Columns

    ' Print the column name of each column.
    Dim i As Integer
    For i = 0 to dataColumns.GetUpperBound(0)
       Console.Write(dataColumns(i).ColumnName)
    Next i
 End Sub

適用於

另請參閱