Gets an array of all DataRow objects that matches the specified sort order and match the filter criteria.
[Visual Basic]
Overloads public function select (_
Byval FilteRexpression As String, _
Byval sort as string _
) As dataroow ()
[C #]
Public DataRow [] SELECT
String FilteRexpression,
String sort
);
[C ]
PUBLIC: DATAROW * SELECT
String * FilteRexpression,
String * sort
[];
[Jscript]
Public Function SELECT
FilteRexpression: String,
Sort: String
: DATAROW [];
parameter
Filterexpression
To screen the conditions for screening.
sort
A string, which specifies the column and sorting direction.
return value
An array of DataRow objects that matches the expression expression.
Note
To form a FilteRexpression parameter, use the same rules as the EXPRESSION attribute value that creates a DataColumn class. The Sort parameter also uses the same rules as the EXPRESSION string that creates class.
Example
[Visual Basic, C #, C ] The following example uses a filter expression to return to the array of DataRow objects.
[Visual Basic]
Private sub getrowsbyfilter ()
Dim t as dataatable
T = dataset1.tables (0)
'PRESUMING The DataTable Has a Column Named Date.
Dim Streetpr AS String
DIM STRSORT AS STRING
strexpr = "DATE> 1/1/00"
'Sort descending by column named companyname.
Strsort = "CompanyName DESC"
Dim FoundRows () AS DATAROW
'Use the select method to find all rows matching the filter.
Foundrows = T.Select (strexpr, strsort)
DIM I as integer
'Print Column 0 of Each Returned Row.
For i = 0 tofactrows.getupperbound (0)
Console.writeline (FoundRows (i) (0))
Next I
End Sub
[C #]
Private void getRowsbyfilter () {
DataTable myTable;
MyTable = DataSet1.tables ["Orders"];
// PRESUMING The DataTable Has A Column Named Date.
String strexpr;
String strs.
Strexpr = "DATE> '1/1/00'"
// sort descending by column named companyname.
strsort = "CompanyName DESC";
DataRow [] FoundRows;
// Use the select method to find all rows matching the filter.foundrows = myTable.select (strexpr, strs);
// Print Column 0 of Each Returned Row.
For (int i = 0; i Console.writeline (FoundRows [i] [0]); } } [C ] Private: Void getRowsbyfilter () { DataTable * myTable; MyTable = DataSet1-> Tables-> Item [S "Orders"]; // PRESUMING The DataTable Has A Column Named Date. String * strexpr; String * strs. Strexpr = s "DATE> '1/1/00'"; // sort descending by column named companyname. strsort = s "CompanyName DESC"; DataRow * FoundRows []; // Use the select method to find all rows matching the filter. Foundrows = MyTable-> SELECT (STREXPR, STRSORT); // Print Column 0 of Each Returned Row. For (int i = 0; i Console :: WriteLine (FoundRows [i] -> Item [0]); } } [JScript] There is no example available for JScript. To view Visual Basic, C # or C examples, click the "Language Filter" button in the upper left corner. Claim Platform: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 Series, .NET Framework Lite See DataTable Class | DataTable Member | System.Data Name Space | DataTable.Select Overload List | CaseSensitive | Expression | DataRow