title: Getting date from SQL Server using users input through winform
body: <p>I'm supposed to take date from the user and then find all dates before that date.</p>
  
  <pre><code>DateTime dat = dateTimePicker1.Value.Date;
  string datS = dat1.ToString("yyyy-MM-dd");
  string query = "SELECT * FROM test3table WHERE datum" + 
                    " &lt;= " + "datum LIKE '%' + @Datum + '%'";
  // '2017-12-06'   -&gt; works fine
  SqlCommand comm = new SqlCommand(query, conn);
  comm.Parameters.AddWithValue("@Datum", datS);
  </code></pre>
  
  <p>Is something wrong with syntax or it cant be done this way?</p>