System.Data Namespace DataView Class
Returns an array of DataRowView objects whose columns match the specified sort key values.
[ VB ]
Overloads Public Function FindRows ( _
ByVal key ( ) As Object _
) As DataRowView ( )
[ C# ]
public DataRowView [ ] FindRows (
object [ ] key
);
[ C++ ]
public: DataRowView [ ] FindRows (
Object* key [ ]
);
[ JScript ]
public function FindRows (
key : Object [ ]
) : DataRowView [ ];
- key
- An array of column values, typed as Object, to search for.
An array of DataRowView objects whose columns match the specified sort key values; or, if no rows contain the specified sort key values, an empty DataRowView array.
The following example uses the FindRows method to return the index of a row that contains specified values in its primary key columns.
private void FindValueInDataView ( DataTable tbl ) {
DataView dv = New DataView ( tbl );
dv.Sort = "Cusomers";
Object [ ] vals;
vals [ 0 ] = "John";
vals [ 1 ] = "Smith";
// FindRows the customer named "John Smith".
DataRowView i = dv.FindRows ( vals );
Response.Write ( dv [ ] );
}
Private Sub FindValueInDataView ( tbl As DataTable )
Dim dv As DataView = New DataView ( tbl )
dv.Sort = "Cusomers"
Dim vals ( 1 ) As Object
vals ( 0 ) = "John"
vals ( 1 ) = "Smith"
' FindRows the customer named "John Smith".
Dim i As DataRowView = dv.FindRows ( vals )
Response.Write ( dv ( i ) )
End Sub |
|
C# |
VB |
DataView Members DataView.FindRows Overload List