Test a bindingsource filter against a single object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PeterRankin
    New Member
    • Jul 2010
    • 4

    Test a bindingsource filter against a single object

    I have a C# .Net application, and I would like to test my bindingsource filter against a single item with some kind of function that returns T/F. If possible, I would like to stay away from converting the table to a DataRow array. If anyone knows of such a function, it would be helpful for me.

    Thanks for your time.
  • PeterRankin
    New Member
    • Jul 2010
    • 4

    #2
    Try DataTable.Selec t

    I ended up using the data table's Select method. Example:

    Code:
    my_data_table = [tableAdapter].GetData();
    
    ...
    
    if (my_data_table.Select("ID = 'my_id' and <rest_of_filter>").Length > 0)
       // item passed filter
    else
       // item did not pass filter
    This method may not be the most efficient method, but it works fine.

    Comment

    Working...