搜索框无法正常工作

时间:2017-09-28 02:58:30

标签: c# xampp

当我在搜索框中输入时,我的数据网格视图不会显示我输入的数据,即使它在数据库中也是如此。这是我搜索框的代码

MySqlConnection con = new MySqlConnection(MyConnectionString);
        con.Open();
        MySqlDataAdapter adapt = new MySqlDataAdapter();
        con = new MySqlConnection(MyConnectionString);
        adapt = new MySqlDataAdapter("SELECT * from tblregister where FirstName like '" + textBox1.Text + "%'", con);
        DataTable ds = new DataTable();
        DataSet dt = new DataSet();
        adapt.Fill(dt);
        dataGridView1.DataSource =ds; 

0 个答案:

没有答案