Jump to content

[C#]2nd Filter is overriding the 1st One.

vern021

I'm working on my project and this is the last thing that I need to fix. I need to filter products based on the selected supplier. The problem comes in my filter(see below).

 

 

u5QPAUj.png

dv.RowFilter = "SupplierName= '" + stcSalesInv.SuppSearch + "'";

dv.RowFilter = fieldName1 + " " + filterOption1 + searchText1 + " OR " + fieldName2 + " " + filterOption2 + searchText2;

 

When I use this one, the second statement overrides the first one.

 

 

UNOtM2v.png

dv.RowFilter = fieldName1 + " " + filterOption1 + searchText1 + " OR " + fieldName2 + " " + filterOption2 + searchText2;

dv.RowFilter = "SupplierName= '" + stcSalesInv.SuppSearch + "'";
 
same problem here.

 

Any suggestions?

(Note: I might not reply immediately because I'll be inactive in a few mins/hrs)

My Current PC Codename: Scrapper

Spoiler

Intel i5-3570 | Some LGA 1155 MOBO Some Generic DDR3 8GB 1600Mhz | PowerColor RX 560 2GB | Recycled HP Case Crucial MX100 128GB 1TB WD Blue 7200RPM | Some Generic 500w PSU | Intel Stock Cooler

Link to comment
Share on other sites

Link to post
Share on other sites

Could it be that you are overwriting your filters with the second one? Your second line replaces the first one, or so it seems here. 

Change the second line in both scenarios to "+=" instead of "="?

Link to comment
Share on other sites

Link to post
Share on other sites

Could it be that you are overwriting your filters with the second one? Your second line replaces the first one, or so it seems here. 

Change the second line in both scenarios to "+=" instead of "="?

I've solved it. I combined it using the "AND" statement. Thanks for the help tho. ^-^

My Current PC Codename: Scrapper

Spoiler

Intel i5-3570 | Some LGA 1155 MOBO Some Generic DDR3 8GB 1600Mhz | PowerColor RX 560 2GB | Recycled HP Case Crucial MX100 128GB 1TB WD Blue 7200RPM | Some Generic 500w PSU | Intel Stock Cooler

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×