473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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.
Aug 3 '10 #1

✓ answered by PeterRankin

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

Expand|Select|Wrap|Line Numbers
  1. my_data_table = [tableAdapter].GetData();
  2.  
  3. ...
  4.  
  5. if (my_data_table.Select("ID = 'my_id' and <rest_of_filter>").Length > 0)
  6.    // item passed filter
  7. else
  8.    // item did not pass filter
This method may not be the most efficient method, but it works fine.

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

Expand|Select|Wrap|Line Numbers
  1. my_data_table = [tableAdapter].GetData();
  2.  
  3. ...
  4.  
  5. if (my_data_table.Select("ID = 'my_id' and <rest_of_filter>").Length > 0)
  6.    // item passed filter
  7. else
  8.    // item did not pass filter
This method may not be the most efficient method, but it works fine.
Aug 6 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Michael McCracken | last post by:
Hi, I have a problem with unittest.TestCase that I could really use some help with. I have a class File in module File. The important thing about File for this discussion is that it's simple -...
1
by: Mike Whalen | last post by:
Hi, I am trying to help out someone who wants to create a custom query. Right now, he has two querys against a 2000+ database of contacts. The first query shows everything. The second query...
0
by: Kurt Krueckeberg | last post by:
In DIP9, can I apply an Emphasize effect to a single object, rather than all objects? Thanks, Kurt
3
by: John Bailey | last post by:
I have a page with a business object that is populated by parsing input from the page (specifically a scanned drivers license). I was hoping that I could display the results using a details view...
3
by: mafandon | last post by:
Is there a way to perform a bindingsource.filter on multiple inputs? For example: I would like the user to be able to put something like <Smith, Jones, Gates> into a textbox and have the...
0
by: meska | last post by:
Hi all, anyone has ideas how to display on ReportViewer items filtered through BindingSource.Filter? Adding a BindingSource through ReportDataSource to LocalReport.DataSources doesn't...
13
by: JohnQ | last post by:
Why would anyone write: class SomeThing // class littered with non-domain single-instancing code :( { private: SomeThing(); static SomeThing* pInstance_; public: static SomeThing*...
2
nev
by: nev | last post by:
Does anyone know how to do that? In my real project actually, I filter on two fields like this... bindingsource.filter = "col1='" & var1 & "' AND col2='" & var2 & "'" wherein var1 or var2 may...
2
by: Phillip B Oldham | last post by:
What would be the optimal/pythonic way to subject an object to a number of tests (based on the object's attributes) and redirect program flow? Say I had the following: pets = {'name':...
0
by: newcooler | last post by:
I have a junction table for instance 1 service can have many contacts - using a composite key junction table. what i want to do is to filter all the contacts that belong to the service using the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.