Is there anyone know how to use LIKE statement?
kayfar
0
Junior Poster in Training
Recommended Answers
Jump to PostHi 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); …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.