DataTable.select method (String)

xiaoxiao2021-03-06  20

Follow the primary key order (if there is no primary key, follow the array of all DATAROW objects that match the filter criteria).

[Visual Basic]

Overloads public function select (_

Byval FilteRexpression As String_

) As dataroow ()

[C #]

Public DataRow [] SELECT

String FilteRexpression

);

[C ]

PUBLIC: DATAROW * SELECT

String * FilteRexpression

[];

[Jscript]

Public Function SELECT

FilteRexpression: String

: DATAROW [];

parameter

Filterexpression

To screen the conditions for screening.

return value

Array of DataRow objects.

Note

To create a FilteRexPression parameter, use the same rules that are used to create the properties of the filter with the Datacolumn 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 ("Orders")

'PRESUMING The DataTable Has a Column Named Date.

Dim Streetpr 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 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;

Strexpr = "DATE> '1/1/00'"

DataRow [] FoundRows;

// Use the select method to find all rows matching the filter.

FoundRows = MyTable.select (strexpr);

// 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;

Strexpr = s "DATE> '1/1/00'";

DataRow * FoundRows [];

// Use the select method to find all rows matching the filter.

Foundrows = MyTable-> SELECT (strexpr);

// Print Column 0 of Each Returned Row.

For (int i = 0; i length; 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

转载请注明原文地址:https://www.9cbs.com/read-42815.html

New Post(0)