| |||||
ForeignKeyConstraint.Equals MethodForeignKeyConstraint Class System.Data Namespace Checks whether the current ForeignKeyConstraint is identical to the specified object. [ VB ] Overrides Public Function Equals ( _ ByVal key As Object _ ) As Boolean [ C# ] public override bool Equals ( object key ); [ C++ ] public: bool Equals ( Object* key ); [ JScript ] public override function Equals ( key : Object ) : Boolean Parameters
Return ValueThis method returns only a boolean value: true, if the objects are identical; otherwise, false. The property is read only with no default value. ExampleThe following example initializes a new ForeignKeyConstraint and checks it against other collection members with the Equals method before adding it to a ConstraintsCollection.
private void CreateConstraint ( DataSet myDataSet ) {
// create the ForignKeyConstraint with two DataColumn objects.
DataColumn parentCol = myDataSet.Tables [ "Customers" ].Columns [ "id" ];
DataColumn childCol = myDataSet.Tables [ "Orders" ].Columns [ "OrderID" ];
ForeignKeyConstraint fKeyConstraint =
new ForeignKeyConstraint ( "MyConstraint", parentCol, childCol );
// test against existing members using the Equals method.
foreach ( ForeignKeyConstraint fcstr in DataSet.Tables [ "Orders" ].Constraints ) {
if ( fKeyConstraint.Equals ( fcstr ) {
Response.Write ( "identical ForeignKeyConstraint!" );
//Insert code to delete the identical object, or stop the procedure.
}
}
}
See Also |
| ||||
Check out related books at Amazon
© 2000-2008 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 aspxtreme