我正在尝试过滤掉我想要的数据,并隐藏所有其他数据。这是我的代码列表,
private void searchButton_Click_1(object sender, EventArgs e)
{
BindingSource bs = new BindingSource();
bs.DataSource = dataGridView1.DataSource;
bs.Filter = dataGridView1.Columns[1].HeaderText.ToString() + " LIKE '%" + searchTextBox.Text + "%'";
dataGridView1.DataSource = bs;
}
但是当我运行它时,它会提示我错误消息
“'ID' 运算符后缺少操作数。”
我也试过这个,同样的错误信息。
private void searchButton_Click_1(object sender, EventArgs e)
{
BindingSource bs = new BindingSource();
bs.DataSource = dataGridView1.DataSource;
// bs.Filter = dataGridView1.Columns[1].HeaderText.ToString() + " LIKE '%" + searchTextBox.Text + "%'";
bs.Filter = "Sample ID like '*" + searchTextBox.Text + "*'";
dataGridView1.DataSource = bs;
}
谁能帮我澄清这个问题?谢谢。