title: Retrieve data from database based on current date and time in SQL Server and ASP.NET
body: <p>I was trying to get the information from my table <code>Paper_Details</code> based on current date and 15 min before the current time.</p>
  
  <p>and this is my <code>SELECT</code> statement</p>
  
  <pre><code>objcmd.CommandText = "Select * from PAPER_DETAILS where ExamDate = Convert(date, getdate()) and StartTime = (Convert(time, getdate()) - 15)"
  </code></pre>
  
  <p>But, it is showing this error </p>
  
  <blockquote>
    <p>Type date is not a defined system type.<br>
    Type time is not a defined system type  </p>
  </blockquote>
  
  <p>I'm using SQL Server 2005 and ASP.NET using VB.</p>
  
  <p>I refer the above query from <a href="http://www.sqlservercentral.com/Forums/Topic1076143-391-1.aspx" rel="nofollow">here</a></p>
  
  <p>Thanks in advance !!</p>
  
  <p><strong>UPDATED</strong></p>
  
  <pre><code>StartTime           |   ExamDate   
  ____________________|_____________________________
  1/1/1900 4:20:00 PM | 7/27/2012 12:00:00 AM
  </code></pre>
  
  <p>The sample data of my table, which will help you to understand the scenario.</p>
  
  <p>From, the above sample data, i wanted that, user can view the information respective to that row only on <code>7/27/2012</code> from <code>4:05:00 PM</code> to <code>4:20:00 PM</code>. I hope, everyone understood my scenario.</p>