The DataRelation Object

for RuBoard

The DataRelation Object

As you've seen in Hour 2, "Working with DataSets and DataTables," the ADO.NET DataSet object can almost precisely mirror data returned from the data source. This includes all the data relations and constraints present in the database as well as the data itself!

In other words, within the DataSet itself, you can create relationships, just like the ones you saw earlier inside SQL Server. After the relationships are set up, you can retrieve relationship-based information without having to write a database query.

graphics/mug.gif

New Functionality with the DataSet !

In addition to giving you great power and flexibility when working with data retrieved from a database, ADO.NET also enables you to retrieve data from two completely different data sources (such as a Microsoft Excel file and a standard comma-delimited text file), create relations, and then navigate those relationships. Essentially, you can apply the power of a relational database system to such disparate data sources as XML files and Microsoft Excel files, without first importing the data to a relational database like Microsoft SQL Server.


The next few sections show you how to use the Relations collection of the DataSet to create relations between two or more DataTable s.

for RuBoard


Sams Teach Yourself ADO. NET in 24 Hours
Sams Teach Yourself ADO.NET in 24 Hours
ISBN: 0672323834
EAN: 2147483647
Year: 2002
Pages: 237

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net