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

Posted on 2004-11-09
Last Modified: 2010-04-24

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.
Question by:veayou
    LVL 27

    Assisted Solution

    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

    LVL 19

    Accepted Solution

    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'"

    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.


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now