Pergunta

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?

Foi útil?

Solução

You have to enclose in brackets

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

Outras dicas

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

Have a look at this link:

MSDN: Data Column Expression

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top