Select a Subset of Data from a DataSet
You want to find specific rows in a DataSet.
Use the DataTable.Select method or the DataRowCollection.Find method.
You can use several approaches to find individual DataRow objects in a DataSet. The most obvious approach is to simply iterate through the collection of DataRow objects until you find one that matches the criteria you are looking for.
Dim MatchedRows() As New ArrayList Dim Row As DataRow For Each Row In Ds.Tables(0).Rows If Row(FieldName) = FieldValue Then MatchedRows.Add(Row) End If Next
However, ADO.NET also provides two more-convenient approaches. First, you can use the DataRowCollection.Find method to find a single row based on its unique primary key. For example, if ...