System.Data Namespace DataRelationCollection Class
Adds a DataRelation to the collection.
1. Adds a DataRelation object to the collection.
2. Adds a DataRelation with the given parent and child columns to the collection.
3. Adds a DataRelation with the given arrays of parent and child columns to the collection.
4. Adds a DataRelation with the given name, and parent and child columns to the collection.
5. Adds a DataRelation with the given name, and arrays of parent and child columns to the collection.
6. Adds a DataRelation with the given name, parent and child columns, and whether to create a constraint.
7. Adds a DataRelation with the given name, arrays of parent and child columns, and whether to create a constraint.
The following example adds a new DataRelation to the collection.
NOTE: This example shows how to use one of the overloaded versions of Add. For other examples that may be available, see the individual overload topics.
ds.Relations.Add ( "categoryId",
ds.Tables [ 0 ].Columns [ "CategoryID" ],
ds.Tables [ 1 ].Columns [ "CategoryID" ] );
ds.Relations.Add ( "categoryId" _
ds.Tables ( 0 ).Columns ( "CategoryID" ), _
ds.Tables ( 1 ).Columns ( "CategoryID" ) ) |
|
C# |
VB |
DataRelationCollection Members
|
|