title: Using C#, SQL Database,How to
body: <p>I have a small question.
  I have used dateTimePicker and I have created a calendar.</p>
  
  <pre><code>    private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
      {
          DateTime varDate;
          varDate = dateTimePicker1.Value; 
      }
  </code></pre>
  
  <p>I have created a button called submit.
  My Task is when a date is selected and the button is clicked it should display records from a database on a datagrid until the selected date.
  For example if I select 12.28.2011 then it should display all the records less than that date.
  I have created database connection and all. But how can we compare the dates??</p>
  
  <p>Please give me some advice regarding this.
  Thank you very much for your time for reading this question.</p>