System.Data Namespace DataView Class
Finds a row in the DataView by the specified primary key values.
[ VB ]
Overloads Public Function Find ( _
ByVal key ( ) As Object _
) As Integer
[ C# ]
public int Find (
object [ ] key
);
[ C++ ]
public: int Find (
Object* key [ ]
);
[ JScript ]
public function Find (
key : Object [ ]
) : int;
- key
- An array of values, typed as Object.
The array of row indexes in the DataView containing the sort key values specified; otherwise a null value if the sort key values do not exist.
The following example uses the Find 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";
// Find the customer named "John Smith".
int i = dv.Find ( 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"
' Find the customer named "John Smith".
Dim i As Integer = dv.Find ( vals )
Response.Write ( dv ( i ) )
End Sub |
|
C# |
VB |
DataView Members DataView.Find Overload List