Question

I have been attempting to use a row filter on a dataview.

It works great for almost all characters except for when I pass it an asterisk.

Dim filterString As String = ""
filterString = "MY_COMPARISON_FIELD LIKE '%" + PassedChar.ToUpper + "%'"
MyDataView.RowFilter = filterString

So, when I pass an asterisk above in as the passedchar var, it just filters by all.

Brings me back to the whole dos *.* usage, which is what I am sure it is doing, wildcarding the asterisk. Anyone, ever figured out how to search on just the asterisk as a char not a wildcard?

Était-ce utile?

La solution

You have to enclose in brackets

Refer this http://www.csharp-examples.net/dataview-rowfilter/

Autres conseils

You need to escape the * in your filter condition by using square brackets [ ].

Have a look at this link:

MSDN: Data Column Expression

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top