Note that there are some explanatory texts on larger screens.

plurals
  1. POC# date and time comparing
    text
    copied!<p>I have a table which contains a two column(<code>start_time</code> and <code>end_time</code>).I am getting the information of start and end time from the user and adding it to the table.Once the user enters the next start and end time I have to compare it with the database.</p> <p>Suppose in table one row has start time as <code>2011-08-10 16:00:00</code> and end time is <code>2011-08-10 16:30:00</code>. Suppose the user enter value <code>2011-08-10 16:05:00.000</code> (<code>start_time</code>) and <code>2011-08-10 16:25:00</code> (<code>end_time</code>) I am able to capture the by using</p> <pre><code> String getConflictTimeInBetween = string.Format("select question_id,question_text from " + data_variables.RES_TXT_STRING_QUESTION_TABLE + " where start_time&lt;='{0}' and end_time&gt;='{1}'", start_full, end_full);//question_text='DFS'"2011-06-23 14:55);// com = new SqlCommand(getConflictTimeInBetween, myConnection); dr = com.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { //Assign to your textbox here conflictQuestionIdAtBetween = dr["question_id"].ToString(); conflictQuestionTextAtBetween=dr["question_text"].ToString(); } } </code></pre> <p>Here are some sample overlaps that I want to prevent</p> <ol> <li><p>start_time from <code>2011-08-10 15:55:00</code> and end_time <code>2011-08-10 16:05:00</code> (five minutes overlap with already existing data)</p></li> <li><p>start_time from <code>2011-08-10 16:25:00</code> and end_time <code>2011-08-10 17:00:00</code> (five minutes overlap with already existing data)</p></li> <li><p>start_time from <code>2011-08-10 15:00:00</code> and end_time <code>2011-08-10 17:00:00</code> (30 minutes overlap with already existing data)</p></li> </ol> <p>Can anyone help me how to solve these three issues.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload