This documentation is archived and is not being maintained.

DataRelation.RelationName Property

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

Namespace: System.Data
Assembly: System.Data (in system.data.dll)

public virtual string RelationName { get; set; }
/** @property */
public String get_RelationName ()

/** @property */
public void set_RelationName (String value)

public function get RelationName () : String

public function set RelationName (value : String)

Not applicable.

Property Value

The name of the a DataRelation.

Exception typeCondition

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.

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

The following example uses the RelationName property to retrieve a DataRelation from a DataRelationCollection.

Private Sub GetRelation()
    ' Get the collection of a DataSet.
    Dim collection As DataRelationCollection = _
        DataSet1.Relations

    ' Add a relation named CustomerOrders.
    Dim myRel As DataRelation = _
        collection("CustomerOrders")

    ' Print the RelationName.
    Console.WriteLine(myRel.RelationName.ToString())
End Sub

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0
Show: