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); 


ADO. NET in a Nutshell
ADO.NET in a Nutshell
ISBN: 0596003617
EAN: 2147483647
Year: 2005
Pages: 415

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net