Cannot perform 'Like' operation on System.Int32 and System.String. DataGridView search and filter

后端 未结 3 1256
旧时难觅i
旧时难觅i 2020-12-16 03:49

I have a form that when I select a column name from a ComboBox, and type in a text box it filters and displays the searched criteria in the DataGridView. When I search for \

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-16 04:00

    Try this perhaps?

    dv.RowFilter = "'%" + comboSearch.Text.Trim() + "%' like '%" + searchTxt.Text.Trim() + "%'";
    

    It may just be a missing quotation, because the query reads as

    "   123 like '%123%'   "
    

提交回复
热议问题