System.Data Namespace DataTable Class
Returns an array of all DataRow objects.
[ VB ]
Overloads Public Function Select ( ) As DataRow ( )
[ C# ]
public DataRow [ ] Select ( );
[ C++ ]
public: DataRow* Select ( ) [ ];
[ JScript ]
public function Select ( ) : DataRow [ ];
An array of DataRow objects.
The method returns the current rows in order of primary key ( or lacking one, order of addition. )
The following example returns an array of DataRow objects through the Select method.
private void GetRows ( ) {
// get the DataTable of a DataSet.
DataTable myTable = myDataSet.Tables [ "Suppliers" ];
DataRow [ ] foundRows = myTable.Select ( );
// print the value of one column of each DataRow.
for ( i = 0; i < foundRows.Length; i++ ) {
Response.Write ( foundRows [ ] [ "CompanyName" ] )
}
}
Private Sub GetRows ( )
' get the DataTable of a DataSet.
Dim myTable As DataTable = myDataSet.Tables ( "Suppliers" )
Dim foundRows ( ) As DataRow = myTable.Select ( )
Dim i As Integer
' print the value of one column of each DataRow.
For i = 0 to Ubound ( foundRows )
Response.Write ( foundRows ( i ) ( "CompanyName" ) )
Next i
End Sub |
|
C# |
VB |
DataTable Members DataTable.Select Overload List CaseSensitive DataRow