简体   繁体   English

Winforms:'Number'运算符后缺少操作数

[英]Winforms: Missing operand after 'Number' operator

I am trying to bind my textbox1 with the datagridview2 so that the textbox can filter the row when the value in textbox and datagridview matches. 我试图将我的textbox1datagridview2绑定,以便当textbox和datagridview中的值匹配时,文本框可以过滤该行。 However, I kept getting the above error. 但是,我一直收到上述错误。 Below is my code 下面是我的代码

private void textBox1_TextChanged(object sender, EventArgs e)
    {
     (dataGridView2.DataSource as DataTable).DefaultView.RowFilter = string.Format("Vehicle Number LIKE '%{0}%'", textBox1.Text); //error here
     }    

There is a space in your column name and thus you will have to escape it. 列名称中有一个空格,因此您必须对其进行转义。 probably like 大概喜欢

"[Vehicle Number] LIKE '%{0}%'" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM