All You Need to Know about ADO.NET: Part 2/2
page 14 of 27
by Devarticles.com
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 55481/ 432

DataRelation Object
Many a time an application has to work with related data. A DataSet does not have a database's inherent capacity to maintain relations, so we have to create a DataRelation object that can maintain these relations.

If we continue with the Northwind example, a DataSet might have some data from the Customers table and the Orders table. Even if the tables contain a key in common (CustomerID), the DataSet itself does not keep track of the records in one table that relate to those in another. You can create a DataRelation object that references the parent and child tables (and their keys), and then use the object to work with the related tables.

The DataRelation object can perform two functions:

  1. It can provide either with the child record or with the parent record depending upon what we are working with.
  2. It can enforce constraints for referential integrity, such as deleting orphaned records.
It is important to understand the difference between a true join and the function of a DataRelation object. In a true join, records are taken from parent and child tables and put into a single, flat recordset. A DataRelation object maintains the synchronization between the related tables and no new recordset is created. Instead, the relation tracks the relationship between tables and keeps parent and child records in synch.

View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 5 and 7 and type the answer here:

User Comments

Title: Thanks   
Name: Amin Anwar
Date: 5/14/2009 5:19:09 AM
Comment:
That isgr8 collection;;;
thanks
Title: Ado.net   
Name: Saurabh Shrivastava
Date: 2/20/2007 11:46:46 AM
Comment:
Brilliant Work,It could be more useful by giving some code in it.
Title: Thank you   
Name: Jayalakshmi baskaran
Date: 5/30/2006 5:39:23 AM
Comment:
I want to create the sqldataAdapter and the Dataset in Code
Can you please help it out
Title: Ado.Net   
Name: Rohan Ragoo
Date: 1/9/2006 12:37:59 PM
Comment:
Excellent Overview. All topics are dicussed in an effective timeline.
Title: XML   
Name: Rajesh Medackel,India
Date: 10/1/2005 5:26:30 AM
Comment:
Good write up .... Thanx
Title: ADO.Net   
Name: k
Date: 5/3/2005 11:31:30 AM
Comment:
to the authors thanks a lot for the unselfish information

Product Spotlight
Product Spotlight 






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 11/21/2009 4:58:59 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search