NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataTable.Select (String)

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[];

Parameters

filterExpression
The criteria to use to filter the rows.

Return Value

An array of DataRow objects.

Remarks

To create the filterExpression argument, use the same rules that apply to the DataColumn class's Expression property value.

Example [Visual Basic]

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

See Also

DataTable Class | DataTable Members | System.Data Namespace | DataTable.Select Overload List | CaseSensitive | Expression | DataRow