Chapter 9. Using DataViews

After completing this chapter, you will be able to:

  • Add a DataView to a form.

  • Create a DataView at run time.

  • Create calculated columns in a DataView.

  • Sort DataView rows.

  • Filter DataView rows.

  • Search a DataView based on a primary key value.

In Chapter 7 we looked at the Select method of the DataTable, which provides a mechanism for filtering and sorting DataRows. The DataView provides another mechanism for performing the same actions at design time.

Understanding DataViews

A DataView provides a filtered and sorted view of a single DataTable. Although the DataView provides the same functionality as the DataTable's Select method, it has a number of advantages. Because DataViews are distinct objects, they can be created and configured ...

Get Microsoft® ADO.NET 2.0 Step by Step, 2nd Edition 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.