Trying to filter an EpiUltraGrid and getting error "Cannot perform 'Like' operation on System.Int32 and System.String."

Hello,

I have a dashboard that I am trying to set up a textbox to filter the grid contents with. I have done it before but this time I am running into an error I haven’t seen before.

Cannot perform ‘Like’ operation on System.Int32 and System.String.

Below is the code I am trying:

var payListEdv = (EpiDataView)(oTrans.EpiDataViews[“V_SDH_APPaymentList_1View”]);
string filter = “CheckHed_CheckNum LIKE ‘6%’”;
payListEdv.dataView.RowFilter = filter;

The 6% in it was just plugged in to see if I had something wrong from the textbox, it gives the same error.

If I change it to “CheckHed_CheckNum = ‘612345’”, it works fine but I want to find partial matches with this filter.

Any help is appreciated.

For anyone out there getting this message, I found an answer.

I used a string.Format to convert the Int column into a string for comparison.

My example which worked was:

string filter = string.Format("convert(CheckHed_CheckNum, ‘System.String’) Like ‘%{0}%’ ", txtPaymentNumber.Text);

CheckHed_CheckNum is an Int column.
txtPaymentNumber.Text is the text from my textbox on the dashboard.

1 Like