DataRelation and  ForeignKeyConstraint  RRS feed

  • Question

  • User1904516115 posted

    What is the difference between DataRelation and  ForeignKeyConstraint  in ADO.NET?

    Friday, January 11, 2019 6:03 AM

All replies

  • User839733648 posted

    Hi vinodkpasi,


    A DataRelation is used to relate two DataTable objects to each other through DataColumn objects.

    For example, in a Customer/Orders relationship, the Customers table is the parent and the Orders table is the child of the relationship.

    This is similar to a primary key/foreign key relationship. 


    Represents an action restriction enforced on a set of columns in a primary key/foreign key relationship when a value or row is either deleted or updated. 

    A DataRelation object can be used to create and enforce a foreign-key constraint, which can be used to maintain referential integrity between a parent and child table in a dataset.

    The DataRelation object is a more general term and can be used for other functions also.

    For more, you could refer to the following links to check the details and related samples.



    Best Regards,


    Friday, January 11, 2019 9:52 AM