Chapter 3. Searching and Analyzing Data
Introduction
This chapter focuses on searching for records in views and tables, calculating values based on values in the same or other tables, and navigating data relations between tables.
The DataView is a data-bindable view of a
DataTable that presents data with different sort
orders and filters. You can create multiple views for each table;
every table has a default data view. The
DataViewManager class helps to manage the default
data views for tables in a DataSet. Recipe 3.1 demonstrates how to use the
DataView and DataViewManager
class to filter and sort data in a DataSet. Recipe 3.12 shows how to filter a data view for rows
that have null values.
The DataRelation class creates a parent/child
relation between two tables in a DataSet. The
DataRelation maintains referential integrity and
you can use it to cascade updates and deletes. It can also be used to
navigate between the tables. Recipe 3.4
shows how to use the data relation to get the parent row and the
child rows for any row.
The DataTable and DataView
classes both provide several ways to locate records from specified
criteria. Searching an existing table or view saves a roundtrip to
the database server. Although the DataView is
created from a DataTable, searching is done
differently in each. Recipe 3.8 shows how to
find rows in a DataTable while Recipe 3.9 shows how to find rows in a
DataView. You can create a
DataView from a typed DataSet
to search or filter. Recipe 3.11 shows how ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access