通过具有整数值的类似语法过滤绑定源

Filter binding source by like syntax with integer value

我想使用绑定源过滤填充数据的列表框。

table中的字段是一个整数,有代码:

tbCarBindingSource.Filter = "Car_ID LIKE '" + Txt_Car_ID_ForAll.Text + "%'";

当我尝试 运行 该程序时,它给了我这些错误:

你可以改成

tbCarBindingSource.Filter =  string.Format("convert(Car_ID, 'System.String') Like '%{0}%' ",Txt_Car_ID_ForAll.Text);