I have a TextBox where you can put in text. When a button is clicked it should query my MsSql-Server to see if it matches anything in the server. The tricky part: I need a query with "like". Eg: select * from recipe where recipeTitle like 'test%' My aim on button click is: Get text from TextBox, do a Sql-Query with 'like' and print output in DataGrid How do I do this in WPF? I have tried the following: private void BTN_suchen_Rezept_Click(object sender, RoutedEventArgs e) { string tbxtext; tbxtext = string.Empty; tbxtext = "'" + TBX_rezept_titel.Text + "%" + "'"; connection3.Open(); SqlCommand cmd7 = new SqlCommand("select * from Rezept where RezeptTitel@RezeptTitel like" , connection3); cmd7.Parameters.AddWithValue("RezeptTitel", tbxtext); SqlDataAdapter da = new SqlDataAdapter(cmd7); DataTable dt = new DataTable(); da.Fill(dt); DGV_Rezepte_view.ItemsSource = dt.DefaultView; connection3.Close(); } Continue reading...