Finds and returns an array of DataRow objects.
Finds and returns an array of DataRow objects using the specified columns and values.
[Visual Basic] Overloads Protected Function FindRows(DataColumn(), Object()) As DataRow ()
[C#] protected DataRow[] FindRows(DataColumn[], Object[]);
[C++] protected: DataRow* FindRows(DataColumn*[], Object[]) [];
[JScript] protected function FindRows(DataColumn[], Object[]) : DataRow[];
Finds and returns an array of DataRow objects with the specified value in the specified column.
[Visual Basic] Overloads Protected Function FindRows(DataColumn, Object) As DataRow ()
[C#] protected DataRow[] FindRows(DataColumn, Object);
[C++] protected: DataRow* FindRows(DataColumn*, Object) [];
[JScript] protected function FindRows(DataColumn, Object) : DataRow[];
Finds and returns an array of DataRow objects using the specified DataKey and values.
[Visual Basic] Overloads Protected Function FindRows(DataKey, Object()) As DataRow ()
[C#] protected DataRow[] FindRows(DataKey, Object[]);
[C++] protected: DataRow* FindRows(DataKey*, Object[]) [];
[JScript] protected function FindRows(DataKey, Object[]) : DataRow[];
The following example sets the DataKey to the columns of a DataTable, and returns an array of DataRow objects that contain the specified values.
Note This example shows how to use one of the overloaded versions of FindRows. For other examples that may be available, see the individual overload topics.
[Visual Basic]
Private Sub FindInDataKey() Dim keyCols() As DataColumn Dim t As DataTable t = DataGrid1.DataSource keyCols = t.PrimaryKey Dim arrVals(1) As Object ' Search for two values, the first is an index, the second a date. arrVals(0) = 1 arrVals(1) = "12/2/99" Dim foundCols() As DataColumn foundCols = t.FindRows(keyCols, arrVals) End Sub