Gets a value indicating whether or not the constraint is on a primary key.
[Visual Basic] Overridable Public ReadOnly Property IsPrimaryKey As Boolean [C#] public bool IsPrimaryKey {override get;} [C++] public: __property virtual bool get_IsPrimaryKey(); [JScript] public function get IsPrimaryKey() : Boolean;
true, if the constraint is on a primary key; otherwise, false.
The following example checks the IsPrimaryKey property.
[Visual Basic]
Private Sub GetPrimaryKey() Dim rel As DataRelation Dim cstrt As UniqueConstraint ' Get a DataRelation from a DataSet. Set rel = DataSet1.Relations("CustomerOrders") ' Get the ParentKeyConstraint. Set cstrt = rel.ParentKeyConstraint ' Test if the IsPrimaryKey is true. If cstrt.IsPrimaryKey Then ' Do something End If End Sub
UniqueConstraint Class | UniqueConstraint Members | System.Data Namespace