in ADO have one function is Filter. What is the same function in ADO.NET?


I have learned ado that it has a function is Filter. But I don't know if ADO.NET can do that?
Please help and provide example is appreciated...

Thank you.
BM.
veayouAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DabasCommented:
Hi veayou,
In general I doubt there is anything in ADO that you cannot do in ADO.NET
But do remember, ADO.NET is NOT a new version of ADO. All they share is the name.

The way to go is DataViews. I suggest you read the help on DataView in general and on RowFilter in particular

Dabas
0
arif_eqbalCommented:
If you have datatable in ADO.NET then
create a view of it
Dim DV as dataView=New DataView(YourDataTable)
DV.RowFilter="Key_Field='The Value'"

then DV contains only the Filtered Rows
However unlike classic ADO the underlying table i.e. YourDataTable still is unfiltered and will show all records

There's another way too in case you want to avoid DataViews
You can use the Default view of the dataTable

YourDataTable.DefaultView.RowFilter="Key_Field='The Value'"
Then

YourDataTable.DefaultView will contain the filtered rows (the underlying table is still same)
So if you are using dataBinding and want to mimic Classic ADO where the recordset used to get filtered what you can do is Bind on the YourDataTable.DefaultView rather than the datatable itself.



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.