Maria

Maria

  • NA
  • 64
  • 0

Cannot perform 'LIKE' operation on System.Int32 and System.String

Dec 16 2008 1:07 PM

I am trying to perform a quick search but I keep getting this error or a similar one

Cannot perform 'LIKE' operation on System.Int32 and System.String

I have a textbox, a find button, and 6 radio buttons.  The search is performed on the columns in my database depending on which radio button is selected.  I am having trouble when I try passing the type int columns.  This is the section of code I am having problems with.

DataRow[] foundRows;
UserTable.DefaultView.Sort="TaxNumber";
foundRows = UserTable.Select("TaxNumber LIKE '" + txtFind.Text+"*'");

I also tried: foundRows = UserTable.Select("TaxNumber LIKE '" + int.Parse(txtFind.Text)+"*'");  but that didnt work either.

Thanks


Answers (5)