title: VS 2005 DateTime Picker date values and SQL Comparison
body: <p>I'm fairly new to VS and .NET.</p>
  
  <p>I have created a new form (in an existing VB.NET application) that retrieves data from a SQL Server 2008 DB into a DataGridView control.</p>
  
  <p>I also need to allow my users to filter the displayed data, so I have added two Datetimepicker controls - one for start date, and one for end date.</p>
  
  <p>when the user clicks the 'Apply filter' button I'd like to either filter the data in the grid client side (it's only for copying and pasting into MS Excel) or requery the database using the two dates as filters...</p>
  
  <p>So I have built a SQL Query string in my VB code like this:</p>
  
  <pre><code>    sSQLQry = "SELECT * FROM ReturnUnpaidData_Audit WHERE [AuditDateTime]&lt;= " &amp; Me.dtPicketEndDate.Value.ToString &amp; " AND [AuditDateTime]&gt;= " &amp; Me.dtPicketEndDate.Value.ToString
  </code></pre>
  
  <p>and this gives me a query string like this:</p>
  
  <pre><code>SELECT * FROM ReturnUnpaidData_Audit WHERE [AuditDateTime]&gt;= 01/03/2013 15:28:09 AND [AuditDateTime]&gt;= 01/03/2013 15:28:09
  </code></pre>
  
  <p>which (unsurprisingly) doesn't work...</p>
  
  <p>So I am a little stuck - can someone point me in the right direction or help me find the best way to do it.</p>
  
  <p>BTW, it's for a small application, not much data (onoy a few rows most likely), 4 or 5 users... no need to worry too much about Big Data or performance</p>