Database Reference
In-Depth Information
Table 15-1. Data View Row States
DataViewRowState Members
Description
Added
A new row
CurrentRows
Current rows including unchanged, new, and modified ones
Deleted
A deleted row
ModifiedCurrent
The current version of a modified row
ModifiedOriginal
The original version of a modified row
None
None of the rows
OriginalRows
Original rows, including unchanged and deleted rows
Unchanged
A row that hasn't been modified
Every time a row is added, modified, or deleted, its row state changes to the appropriate one in
Table 15-1. This is useful if you're interested in retrieving, sorting, or filtering specific rows based on
their state (for example, all new rows in the data table or all rows that have been modified).
You then bind the data view to the grid view as a data source.
// display data from data view
gvContact.DataSource = dv;
Just as a data row represents a single row in a data table, a data row view (perhaps it would have
been better to call it a data view row ) represents a single row in a data view. You retrieve the filtered and
the sorted column data for each data row view and output it to the console.
As this simple example suggests, data views offer a powerful and flexible means of dynamically
changing what data works within a data table.
Modifying Data in a Dataset
In the following sections, you'll work through a practical example showing a number of ways to update
data in data tables programmatically. Note that here you'll just modify the data in the data set but not
update the data in the database. You'll see in the “Propagating Changes to a Data Source” section how to
persist the original data source changes made to a data set.
Note Changes you make to a data set aren't automatically propagated to a database. To save the changes in a
database, you need to connect to the database again and explicitly perform the necessary updates.
 
Search WWH ::




Custom Search