查询字母数字组合的id时(例如a01),显示报错“Unknown column in where clause”,请问是怎么回事?

用winform查询MySQL数据库时,只能查询纯数字组合,不能查询数字、字母等组合
string str = "";
         if (textBox1.Text.Trim() != "")
         str = "where id like " + textBox1.Text.Trim();
        try
        {
            string searchStr = ("select * from student " + str);
            MySqlDataAdapter adapter = new MySqlDataAdapter(searchStr, SQLCon);
            DataTable a = new DataTable();
            adapter.Fill(a);
            this.dataGridView1.DataSource = a;
        }
        catch (MySqlException ex)
        {
            MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK);
        }
报错“Unknown column in where clause”
我的解答思路和尝试过的方法
我想要达到的结果

注意一下下面两个sql的区别

select * from student  where id = 'abc123';
select * from student  where id = abc123 ;

上面两个sql中,第2条是有问题的,sql里的字符串,需要使用单引号包裹,否则就会被认为是列名或参数名什么的,而非具体的值。
所以你把你拼接的sql稍微再改下就行了