title: Select Data from Database, using Today's Date as criteria
body: <p>I have a winform C#/SQL Project going on, 
  Where in I have a datatable where data is stored with corresponding time stamp, E.G. when a user registers a complaint the exact/near enough timestamp is stored in the table. it is stored in "MMM dd yyyy hh:mm:ss" format, the table column is of "datetime".</p>
  
  <p>i have a need to select all the entries in the table where the date is today's...
  so far here is my code..</p>
  
  <pre><code>SqlConnection tod1 = new SqlConnection(@"Data Source=2011-GOA-RCC3\SQLEXPRESS;Initial Catalog=IOB_Comm;Integrated Security=True");
  tod1.Open();
  SqlCommand todc1 = new SqlCommand();
  todc1.Connection = tod1;
  
  DateTime today = DateTime.Today;
  //DateTime todayl = today.AddDays();
  DateTime dnext = today.AddDays(1);
  label4.Text = today.ToString("MMM dd yyyy 00:00");
  label5.Text = dnext.ToString("MMM dd yyyy 00:00");
  label6.Text = label4.Text;
  label7.Text = label5.Text;
  
  DateTime d1 = Convert.ToDateTime(label4.Text);
  DateTime d2 = Convert.ToDateTime(label5.Text);
  dateTimePicker3.Value = today;
  dateTimePicker4.Value = dnext;
  
  var d3 = Convert.ToString(label4.Text);
  var d4 = Convert.ToString(label5.Text);
  //todc.CommandText = "Select * from DCR Where Comp_Date &gt;= '" + d1 + "' And Comp_Date &lt;= '" + d2 + "' Order By Comp_Date Asc";
  //todc.CommandText = "Select * from DCR Where Comp_Date '" + DateTime.Today + "'Order by Comp_Date Asc";
  todc1.CommandText = "Select * from DCR Where Comp_Date &gt;= '"+ dateTimePicker3.Text +"' And Comp_Date &lt; '"+dateTimePicker4.Text+"' Order By Comp_Date Desc";
  int a = todc1.ExecuteNonQuery();
  label8.Text = a.ToString();
  if (a &gt; 0)
  {
      //bind to report viewer
  }
  </code></pre>
  
  <p>but the <code>int a = todc1.ExecuteNonQuery();</code> Always returns -1. so I diagnosed that my query is not executing correctly.</p>
  
  <p>I've tried a many lot of approaches but none of them work, whats more troubling is that a similar query executes perfectly in SQL. </p>