Is there anyone know how to use LIKE statement?

Hi Kayfar,

Try this code.

private void button1_Click(object sender, EventArgs e)
        {
            OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Northwind.mdb");
            conn.Open();
            String sqlText = "SELECT * FROM Customers WHERE CompanyName LIKE '%" + textBox1.Text + "%'";
            OleDbDataAdapter adapter = new OleDbDataAdapter(sqlText, conn);
            DataTable dtCust = new DataTable();
            adapter.Fill(dtCust);
            conn.Close();
            dataGridView1.DataSource = dtCust;
        }

Also refer this link.

Microsoft Office Access 2007 - Like Operator

sorry..i'm new in c#..i got this error..

Line 27:         OleDbDataAdapter adapter = new OleDbDataAdapter(sqlText, conn);
Line 28:         DataTable dtCust = new DataTable();
Line 29:         adapter.Fill(dnis);
Line 30:         conn.Close();
Line 31:         dataGridView1.DataSource = dnis;