vb.net - Cannot perform 'Like' operation on System.Decimal and System.String -


i want use filter on datagridview according below method:

 dt = executeselect(querycondition, idwindow).tables(0)         _textfilters = ""              dim first boolean = true              each f field in fields                 if f.value.length > 0                      if not first                         _textfilters += " , "                     end if                 _textfilters &=  f.field &  " '%" & f.value & "%'"                     first = false                 end if         next          dt.defaultview.rowfilter = _textfilters 

i got error in line

 dt.defaultview.rowfilter = _textfilters 

cannot perform 'like' operation on system.decimal , system.string

because have decimal fields in database table.

but if use:

 dim view dataview = new dataview(grille.datasource) _textfilters = "" dim first boolean = true  each f field in fields                 if f.value.length > 0                 if not first                     _textfilters += " , "                 end if                 select case f.field.gettype.tostring                     case "string"                         _textfilters &= f.field & " '%" & f.value & "%'"                     case "datetime"                     case else                         _textfilters &= f.field & ">=" & f.value                 end select                      first = false                 end if         next          view.rowfilter = _textfilters 

the code doesnt send error filter doesn't work .

hope i'm clear

thanks in advance

the operator purely stings. if want filter on decimal data type should use 1 of following operators: <, >, =.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -