title: Compare date from textbox with date in database in ASP.NET using C#
body: <p>I am trying to compare a date I enter in a textbox in a <code>DD.MM.YYYY</code> format and I get an error.</p>
  
  <pre><code>string txt = "select count(*) from cont where Data_deschiderii &lt; " + Convert.ToDateTime(TextBox1.Text).ToString("DD.MM.YYYY");
  
  SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
  conn.Open();
  
  SqlCommand cmd = new SqlCommand(txt, conn);
  int x = Convert.ToInt32(cmd.ExecuteScalar().ToString());
  Response.Write(x);
  </code></pre>
  
  <p>How could I do it? I couldn't find ANYTHING on the internet</p>