System.Data Namespace DataRelation Class
Initializes a new instance of the DataRelation class.
1. Initializes a new instance of the DataRelation class using the specified name, parent, and child columns.
2. Initializes a new instance of the DataRelation class using the specified name, parent and child columns, and a value indicating whether to create constraints.
3. Initializes a new instance of the DataRelation class using the specified name and matched arrays of parent and child columns.
4. Initializes a new instance of the DataRelation class using the specified name, matched arrays of parent and child columns, and a value indicating whether to create constraints.
The following example initializes a new DataRelation and adds it to the DataRelationCollection of a DataSet.
NOTE: This example uses one of the overloaded versions of the DataRelation constructor. For other examples that may be available, see the individual overload topics.
DataRelation categoryId = new DataRelation ( "categoryId",
myDataSet.Tables [ "Categories" ].Columns [ "CategoryID" ],
myDataSet.Tables [ "Products" ].Columns [ "CategoryID" ] );
// add the relation to the DataSet.
myDataSet.Relations.Add ( categoryId );
Dim categoryId As New DataRelation ( "categoryId", _
myDataSet.Tables ( "Categories" ).Columns ( "CategoryID" ), _
myDataSet.Tables ( "Products" ).Columns ( "CategoryID" ) )
' add the relation to the DataSet.
myDataSet.Relations.Add ( categoryId ) |
|
C# |
VB |
Show me
DataRelation Members
|
|