Dataview Rowfilter

  • Thread starter Thread starter Georg Schmelzer
  • Start date Start date
G

Georg Schmelzer

Hi Ng,

need some help here. What's wrong with that dataview.rowfilter expression:


dtFliste.DefaultView.RowFilter = "Field1 Like '%" & strFV & "%'" & _
" AND Field2 Like '%" & strFS & "%'" & _
" AND Field3 Like '%" & strFT & "%'" & _
" AND Field4 Like '%" & strGW & "%'" & _
" AND Field5 Like '%" & strKu & "%'" & _
" AND Field6 Like '%" & strIb & "%'"



As this filter always returns an empty datatable?

Thanks a Lot.

G. Schmelzer
 
Georg Schmelzer said:
Hi Ng,

need some help here. What's wrong with that dataview.rowfilter expression:


dtFliste.DefaultView.RowFilter = "Field1 Like '%" & strFV & "%'" & _
" AND Field2 Like '%" & strFS & "%'" & _
" AND Field3 Like '%" & strFT & "%'" & _
" AND Field4 Like '%" & strGW & "%'" & _
" AND Field5 Like '%" & strKu & "%'" & _
" AND Field6 Like '%" & strIb & "%'"



As this filter always returns an empty datatable?

Thanks a Lot.

G. Schmelzer


Do any of your str* fields have leading or trailing blanks which may cause
no records to be selected?
 
Georg,
In addition to the other comments:

You are using AND, which means that all the conditions HAVE to be True!

Are you certain that ALL the conditions are true?

For example if you only match on Field1, do you get records?

Also can you use Debug.WriteLine to print out the RowFilter after you set
it? As that would show us what the RowFilter itself looks like (it would
help identify badly formed filters). Can you post what RowFilter contains
after you set it if its now obvious to you what the problem is.

Hope this helps
Jay
 
Hi,

I solved the Problem myself. I just took a stringbuilder and build a string
which contains only those parts of the filter that aren't empty.

But thank you anyway.


mfg G. Schmelzer
 
George,
Glad you got it to work...

I was actually concerned that it was the "parts you didn't need" that was
messing you up.

Thanks for letting us know.
Jay
 
Back
Top