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
Post a Comment