I see that you try to filter the results after being fetched.
If you want to filter the results on the fetch process, you might want to do the folowing:
Dim RETL As New RequestAndProfitCentreAccountTypedList
Dim filter As New PredicateExpression
filter.Add(PredicateFactory.CompareValue(RequestAndProfitCentreAccountFieldIndex.Id, ComparisonOperator.Equal, SomeID))
Dim Bucket As New RelationPredicateBucket
Bucket.PredicateExpression.Add(filter)
Dim adapter As New DataAccessAdapter
adapter.FetchTypedList(RETL.GetFieldsInfo(), RETL, Bucket, 0, sorter, False)
If you want to get all the records then filter them later using a DataView
Then just skip the Bucket filtering from the above code and call the FetchTypedList as follows:
adapter.FetchTypedList(RETL.GetFieldsInfo(), RETL, Nothing, 0, sorter, False)
and use the DefaultView RowFilter as you did.
P.S. the DataAccessAdapter close the connection on its own unless you passes true to the constructor to keep the connection open, then you should call the CloseConnection method to close it at the end.
- Please excuse any VB syntax mistakes