Creating and Using DataViews

A DataView enables you to create different views of the data stored in a DataTable, a capability that is often used in data-binding applications. Using a DataView, you can expose the data in a table with different sort orders, and you can filter the data by row state or based on a filter expression.

A DataView provides a dynamic view of data whose content, ordering, and membership reflect changes to the underlying DataTable as they occur. This is different from the Select method of the DataTable, which returns a DataRow array from a table per a particular filter and/or sort order and whose content reflects changes to the underlying table, but whose membership and ordering remain static. The dynamic capabilities of the DataView make it ideal for data-binding applications.

A DataView provides you with a dynamic view of a single set of data to which you can apply different sorting and filtering criteria, similar to the view provided by a database. However, a DataView differs significantly from a database view in that the DataView cannot be treated as a table and cannot provide a view of joined tables. You also cannot exclude columns that exist in the source table, nor can you append columns, such as computational columns, that do not exist in the source table.

You use a DataViewManager to manage view settings for all the tables in a DataSet. The DataViewManager provides you with a convenient way to manage default view settings for each table. When binding a control to more than one table of a DataSet, binding to a DataViewManager is the ideal choice.

In This Section

  • Building Applications
    Provides information about creating .NET Framework applications such as ASP.NET applications, Windows Forms applications, and Windows Services. Includes information about data binding to Windows Forms controls and Web Forms controls.
  • Creating and Using DataSets
    Describes the DataSet object and how you can use it to manage application data.
  • Creating and Using DataTables
    Describes the DataTable object and how you can use it to manage application data by itself or as part of a DataSet.
  • Accessing Data with ADO.NET
    Describes the ADO.NET architecture and components and how to use them to access existing data sources as well as to manage application data.