title: Between the time in SQL Server and ASP.NET
body: <p>I am storing <code>STARTTIME</code> and <code>ENDTIME</code> in a SQL Server table by using ASP.NET webform.</p>
  <pre><code> timeTableID       startTimeVal      endTimeVal
  -------------------------------------------------
      1       07:30:00.0000000    08:00:00.0000000
      2       08:00:00.0000000    08:30:00.0000000
      3       08:15:00.0000000    08:25:00.0000000
  </code></pre>
  <p>Now, as you can see in the row with <code>timeTableID = 2</code>, the inserted time value is 8:00 &amp; 8:30 AM,</p>
  <p>But in the row with <code>timeTableID    = 3</code>, the inserted time value is 8:15 &amp; 8:25 AM,</p>
  <p>I don't want this because its within value of row 2.</p>
  <p>My problem is, the next entry should not between the already inserted time.</p>
  <p>My attempt:</p>
  <pre><code>select timeTableID 
  from timetableTbl 
  where dayVal = 'MONDAY' 
    and StartTimeVal between '&quot; + startTimeTxt.Text + &quot;' and '&quot; + endTimeTxt.Text + &quot;' and endTimeVal between '&quot; + startTimeTxt.Text + &quot;' and '&quot; + endTimeTxt.Text + &quot;'
  </code></pre>
  <p>Here <code>startTimeTxt</code> is the textbox for <code>startTimeVal</code> and <code>endTimeTxt</code> is the textbox for <code>endTimeVal</code>.</p>
  <p>Please help me with this</p>