The Select method enables users to retrieve rows based on three elements: a filter expression, sort order and by DataViewRowState.
In the example below, we pass in null values to parts of the statement we want to ignore. In this case the select method will bring back all the current rows.
[VB] Dim CurrRows() As DataRow = workTable.Select(Nothing, Nothing, _ System.Data.DataViewRowState.CurrentRows) [C#] DataRow[] CurrRows = workTable.Select(null, null, System.Data.DataViewRowState.CurrentRows );
We could ask for all rows with a last name of "Smith" ordered by the column named "CustomerNameFirst."
[VB] Dim myNames() As DataRow = workTable.Select("CustomerLastName = 'Smith'"), _ "CustomerNameFirst", System.Data.DataViewRowState.CurrentRows) [C#] DataRow[] myNames = worktable.Select("CustomerNameLast = 'Smith'", "CustomerNameFirst", System.Data.DataViewRowState.CurrentRows);