SIGN UP MEMBER LOGIN:    
ARTICLE

Data Set and Data View objects in ADO.NET

Posted by Mahesh Chand Articles | ADO.NET in C# October 07, 2009
In this article I will explain you Data Set and Data View objects in ADO.NET.
Reader Level:


DataSet Structure

A DataSet object falls in disconnected components series. You can use it with or without data providers. The DataSet consists of a collection of tables, rows, columns and relationships. Figure 1 illustrates these relationships specifically that the DataSet contains a collection of DataTables and the DataTable contains a collection of DataRows, DataRelations, and DataColumns. A DataTable maps to a table in the database. The previous DataSet contains a DataTable that maps to the Orders table because you filled it with a SELECT query executed on the Order table.

Figure-3.10.gif

Figure 1: The relationship between classes in a dataset

Well, now you see how you can look at your tables, but you still really haven't seen any hard data yet. The data in a DataSet is contained in the DataRow. A DataTable in the DataSet consists of a collection of DataRow. Each DataRow can be accessed via an index or the column name. As you can see from figure 1, a data set has a one-to-many relationship with DataTable. That means a DataSet can have one or more than one DataTable objects. Similarly, a DataTable can have one or more than one DataRelation, DataRow, and DataColumn objects.

DataSets in DataViews

Another thing you can do with the contents of your DataSet is sort and filter them using DataViews. You can have multiple Views of a dataset. A DataView is a view of your data created according to certain criteria. Each DataView has a one-to-one mapping to a DataTable in a DataSet. For example, say you have three tables in a dataset: table 1, table2, and table3. Using three different data tables and data views, you can represent this dataset in three different views. Using sort and filters, you can even sort and filter the data based on some criteria. Figure 2 shows three different views of a dataset in the form of three different data views.

Figure-3.11.gif

Figure 2: The relationship between Data Set and Data View objects

A dataview can directly attach to data-bound controls such as a DataGrid, DataList, or a Combo box.

Conclusion

Hope this article would have helped you in understanding Data Set and Data View objects. See my other articles on the website on ADO.NET.

Login to add your contents and source code to this article
share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Gauge for SharePoint
Become a Sponsor