asp.net.ph

DataRelationCollection.Add Method ( String, DataColumn [ ], DataColumn [ ], Boolean )

System.Data Namespace   DataRelationCollection Class


Adds a DataRelation with the given name, arrays of parent and child columns, and whether to create a constraint.

[ VB ]
Overridable Overloads Public Function Add ( _
   ByVal name As String, _
   ByVal parentColumns ( ) As DataColumn, _
   ByVal childColumns ( ) As DataColumn, _
   ByVal createConstraints As Boolean _
) As DataRelation

[ C# ]
public virtual DataRelation Add (
   string name,
   DataColumn [ ] parentColumns,
   DataColumn [ ] childColumns,
   bool createConstraints
);

[ C++ ]
public: virtual DataRelation* Add (
   String* name,
   DataColumn* parentColumns [ ],
   DataColumn* childColumns [ ],
   bool createConstraints
);

[ JScript ]
public function Add (
   name : String,
   parentColumns : DataColumn [ ],
   childColumns : DataColumn [ ],
   createConstraints : Boolean
) : DataRelation;

Parameters

name
The name of the relation.
parentColumns
The parent columns of the relation.
childColumns
The child columns of the relation.
createConstraints
true to create constraints; otherwise false. Default is true.

Return Value

The newly created DataRelation.

Exceptions


Exception Type Condition
ArgumentException Occurs when the relation already belongs to this collection, or it belongs to another collection.
DuplicateNameException Occurs when the collection already has a relation with the specified name. The comparison is case insensitive.
InvalidConstraintException Occurs when the relation cannot be created based on the given parameters.

Remarks

This version of the Add method creates a relation given the above parameters and adds it to the collection. The CollectionChanged event is fired if it succeeds.

See Also

DataRelationCollection Members   DataRelationCollection.Add Overload List Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph