title: Date format error in vb.net?
body: <p>I get this error when I run the application <code>Incorrect syntax near 12</code>, on debugging I found that this error is caused due to the # along with the date. </p>
  
  <pre><code>Dim backdate as datetime
  backdate = DateTime.Now.AddDays(-1)
  </code></pre>
  
  <p>on binding the data to the grid to filter the backdate records this error is caused <strong>Incorrect syntax near 12</strong>.</p>
  
  <pre><code>myqry =  " select SRNO,SUBJECT,ID where datesend =" backdate 
  </code></pre>
  
  <p>Now i am trying to extract only the date or shall I divide the date into day , month and year with <code>DATEPART</code> and take into a variable or convert the date  or what should i do , Please help ???</p>