System.Data Namespace DataView Class
Finds a row in the DataView by the specified primary key value.
[ 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
- The object to search for.
The index of the row in the DataView containing the sort key value specified; otherwise a null value if the sort key value does not exist.
The following example uses the Find method to return the index of the row containing the desired value in the primary key column.
private void FindValueInDataView ( DataTable tbl ) {
DataView dv = New DataView ( tbl );
dv.Sort = "CusomerID";
// Find the customer named "Smith" in the primary key column
int i = dv.Find ( "Smith" );
Response.Write ( dv [ ] );
}
Private Sub FindValueInDataView ( tbl As DataTable )
Dim dv As DataView = New DataView ( tbl )
dv.Sort = "CusomerID"
' Find the customer named "Smith" in the primary key column
Dim i As Integer = dv.Find ( "Smith" )
Response.Write ( dv ( i ) )
End Sub |
|
C# |
VB |
DataView Members DataView.Find Overload List Delete