Returns an array of all DataRow objects that match the filter criteria in order of primary key (or lacking one, order of addition.)
[Visual Basic] Overloads Public Function Select( _ ByVal filterExpression As String _ ) As DataRow () [C#] public DataRow[] Select( string filterExpression ); [C++] public: DataRow* Select( String* filterExpression ) []; [JScript] public function Select( filterExpression : String ) : DataRow[];
An array of DataRow objects.
To create the filterExpression argument, use the same rules that apply to the DataColumn class's Expression property value.
The following example uses a filter expression to return an array of DataRow objects.
[Visual Basic]
Private Sub GetRowsByFilter() Dim t As DataTable t = DataSet1.Tables("Orders") ' Presuming the DataTable has a column named Date. Dim strExpr As String strExpr = "Date > '1/1/00'" Dim foundRows() As DataRow ' Use the Select method to find all rows matching the filter. foundRows = t.Select(strExpr) Dim i As Integer ' Print column 0 of each returned row. For i = 0 to Ubound(foundRows) Console.WriteLine(foundRows(i)(0)) Next i End Sub
DataTable Class | DataTable Members | System.Data Namespace | DataTable.Select Overload List | CaseSensitive | Expression | DataRow