Gets or sets the name used to look up this relation in the parent data set's RelationsCollection.
[Visual Basic] Overridable Public Property RelationName As String [C#] public string RelationName {virtual get; virtual set;} [C++] public: __property virtual String* get_RelationName(); public: __property virtual void set_RelationName(String*); [JScript] public function get RelationName() : String; public function set RelationName(String);
The name of the relation.
Exception Type | Condition |
---|---|
ArgumentException | A null or empty string ("") was passed in and the relation belongs to a collection. |
DuplicateNameException | The relation belongs to a collection that contains a relation of the same name. The string comparison is not case-sensitive. |
The RelationName is used to look up this relation in the parent DataSet object's RelationsCollection.
The following example retrieves a named relation from a RelationsCollection.
[Visual Basic]
Private Sub GetRelation() Dim dRels As RelationsCollection ' Get the collection of a DataSet dRels = DataSet1.Relations ' Add a relation named CustomerOrders Dim myRel As DataRelation myRel = dRels("CustomerOrders") ' Just to make sure, print the RelationName. Debugl.Print myRel.RelationName End Sub
DataRelation Class | DataRelation Members | System.Data Namespace | DataSet | RelationsCollection | Item