DekGenius.com
[ Team LiB ] Previous Section Next Section

7.10 Selecting a Subset of Rows

The Select( ) method returns a subset of rows from the DataTable and returns the result as a DataRow array. The four overloads take optional arguments specifying the filter criteria, sort order, and DataViewRowState of the rows to be returned. The following example illustrates this concept:

// all rows with order amount > 100, sorted on the order date descending
DataRow[] dra = dt.Select("OrderAmount>100.00", "OrderDate DESC");

The following example returns all modified rows in the table:

DataRow[] dra = dt.Select(null, null, DataViewRowState.ModifiedCurrent);
    [ Team LiB ] Previous Section Next Section