10
Cannot perform ‘Like’ operation on System.Decimal and System.String.
When i was trying to use the dataview rowfilter functionality, i came across this type of issue.
I tried to find some soultions on internet but was unable to get any..
This issue comes when we try to search from the column which is numeric / decimal suing LIKE query, hence the datatype decimal doesnt matches with the search text which is string.
To overcome this issue, I used the following steps
1. modified the database sql query by using cast
eg:
select invoiceno from tblinvoice
to
select cast(invoiceno as varchar) from tblinvoice
Note : If you are using custom datatable, kindly change the datatable column datatype to string.
Many times, we have the restriction to not to change the datatype because of some calculations required using decimal field.
In that case, i suggest to create additional column as string datatype.
eg :
select invoiceno, cast(invoiceno as varchar) as strinvoiceno from tblinvoice.
and hide the column strinvoiceno from datatable.
Hope this helps you !!
Hi, nice posts there
thank’s for the interesting information