Reputation: 11
I have a DataTable
as follows
ID Name Type
1 Ram Employee
2 John Supplier
3 Uma Employee
1 Ravi Supplier
I assigned it to PartyDV
. I am using the RowFilter
as
PartyDV.RowFilter = "Type = 'Supplier'"
after that I am using the RowFilter
in the same DV. In this I am not clearing the RowFilter
.
PartyDV.RowFilter = "ID = 1"
what will be my answer
A)
ID Name Type
1 Ravi Supplier
B)
ID Name Type
1 Ram Employee
1 Ravi Supplier
A or B?
Upvotes: 1
Views: 111
Reputation: 2279
Of course your answer would be B, cause even you aren't clearing the filter, but the program will clear by itself. I have ever made thing like this. It just like your answer B. If you want your answer to be A. You must having two filter at a time.
like this (just like what @Milky Dinescu) answer
PartyDV.RowFilter = "Type = 'Supplier' AND ID = 1"
Of course you can't divide them just as your question. Cause it will be same result. Logic thinking : Just like you write
textbox1.text = "first" 'it will be first as value
textbox1.text = "Second" 'it will be second as value, first will be delete
if you want to combine, you must like this isn't it?
textbox1.text = "First" & "Second"
So, it's the same logic as filter
Upvotes: 0
Reputation: 55720
It looks like your answer will be "B" but you could have figured that out yourself by running the code!
Basically when you execute the following lines of code:
PartyDV.RowFilter = "Type = 'Supplier'"
PartyDV.RowFilter = "ID = 1"
The second will override the first. They don't add up.
If you wanted to use both filters you may try this:
PartyDV.RowFilter = "Type = 'Supplier' AND ID = 1"
Upvotes: 1