Filter datatable from text box and datetime picker
- private void izvjestajoprodanimartiklima()
- {
- using (SqlConnection openCon = new SqlConnection(cs))
-
- {
-
- String saveStaff = "SELECT roba as 'Naziv artikla', SUM (cast(kolicina as float)) as 'Kolicina' from (select roba, kolicina from mp_racun_roba union all select roba, kolicina from mp_faktura_roba) as alltables group by roba";
-
-
-
-
- if (!string.IsNullOrEmpty(textBox1.Text))
- {
- saveStaff += "roba LIKE '%" + textBox1.Text + "%' ";
- }
-
-
- if (checkBox1.Checked)
- {
- String strFilterDTP1 = dateTimePicker1.Value.ToString("yyyy-MM-dd");
- String strFilterDTP2 = dateTimePicker2.Value.ToString("yyyy-MM-dd");
-
-
-
- saveStaff += strFilterDTP1 + " 00:00:00' AND '" + strFilterDTP2 + " 23:59:59' ";
-
- }
error line 14 Incorrect syntax near the keyword 'LIKE'.
Some help?