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

Returns an array of DataRow objects.

Overload List

Returns an array of all DataRow objects.

[Visual Basic] Overloads Public Function Select() As DataRow ()
[C#] public DataRow[] Select();
[C++] public: DataRow* Select() [];
[JScript] public function Select() : DataRow[];

Returns an array of all DataRow objects that match the filter in the order of the sort, that match the specified state.

[Visual Basic] Overloads Public Function Select(String, String, DataViewRowState) As DataRow ()
[C#] public DataRow[] Select(String, String, DataViewRowState);
[C++] public: DataRow* Select(String*, String*, DataViewRowState) [];
[JScript] public function Select(String, String, DataViewRowState) : DataRow[];

Returns an array of all DataRow objects that match the filter criteria, in the the specified sort order.

[Visual Basic] Overloads Public Function Select(String, String) As DataRow ()
[C#] public DataRow[] Select(String, String);
[C++] public: DataRow* Select(String*, String*) [];
[JScript] public function Select(String, String) : DataRow[];

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(String) As DataRow ()
[C#] public DataRow[] Select(String);
[C++] public: DataRow* Select(String*) [];
[JScript] public function Select(String) : DataRow[];

Example [Visual Basic]

The following example uses a filter expression to return an array of DataRow objects.

Note   This example shows how to use one of the overloaded versions of Select. For other examples that may be available, see the individual overload topics.

[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