Using a DataView

The final common technique used to work with a DataSet is to display its data using a DataView. Simply put, a DataView object is a view of a particular DataTable within a DataSet that can expose the data in a particular sort order or can filter the data. In other words, you can use a DataView to create a filtered and sorted view of a DataTable and then bind that view to a Windows or Web Forms control by referencing the DataView in the control's DataSource property. Unlike the Select statement discussed earlier, the DataView doesn't create copies of the rows, but is dynamic in that all changes to the underlying DataTable are immediately reflected in the DataView.

Note

A DataView is different from a relational database view in ...

Get Sams Teach Yourself ADO.NET in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.