Export (0) Print
Expand All

DataRelation.RelationName Property

Gets or sets the name used to retrieve a DataRelation from the DataRelationCollection.

[Visual Basic]
Public Overridable Property RelationName As String
[C#]
public virtual string RelationName {get; 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);

Property Value

The name of the a DataRelation.

Exceptions

Exception Type Condition
ArgumentException A null reference (Nothing in Visual Basic) or empty string ("") was passed into a DataColumn that is a DataRelation.
DuplicateNameException The DataRelation belongs to a collection that already contains a DataRelation with the same name.

Remarks

Use the RelationName property to retrieve a DataRelation from the DataRelationCollection.

Example

[Visual Basic] The following example uses the RelationName property to retrieve a DataRelation from a DataRelationCollection.

[Visual Basic] 
Private Sub GetRelation()
    Dim dRels As DataRelationCollection
    ' 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.
    Debug.Write(myRel.RelationName)
 
 End Sub

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataRelation Class | DataRelation Members | System.Data Namespace | DataSet | DataRelationCollection | Item

Show:
© 2014 Microsoft