Sort result from given period of time using Calendar.http://forums.asp.net/t/1794461.aspx/1?Sort+result+from+given+period+of+time+using+Calendar+Thu, 19 Apr 2012 06:05:36 -040017944614939918http://forums.asp.net/p/1794461/4939918.aspx/1?Sort+result+from+given+period+of+time+using+Calendar+Sort result from given period of time using Calendar. <p>I am trying to generate gridview report using input given by user. So part of it, user will be given two textboxes (From and To) where user can click on calendar and the choosen date will be passed to the text box. From the given input (From date X to date Y), it should be able to search in access no matter what's the date given as long it is in the range and display the result in a gridview.</p> <p>Here I am unsure whether it can be done and how must I construct the query using sql and C#. Can anyone help on this problem?</p> <p>Below are the .aspx code for the two textboxes:</p> <p>&nbsp;</p> <pre class="prettyprint">From: &lt;asp:TextBox ID=&quot;from&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt; &lt;asp:LinkButton ID=&quot;LinkButton1&quot; runat=&quot;server&quot; onclick=&quot;LinkButton1_Click&quot;&gt;Pick Date&lt;/asp:LinkButton&gt; &amp;nbsp;&lt;asp:Calendar ID=&quot;Calendar1&quot; runat=&quot;server&quot; onselectionchanged=&quot;Calendar1_SelectionChanged&quot; TitleFormat=&quot;Month&quot; Visible=&quot;False&quot;&gt;&lt;/asp:Calendar&gt; To: &lt;asp:TextBox ID=&quot;to&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt; &lt;asp:LinkButton ID=&quot;LinkButton2&quot; runat=&quot;server&quot; onclick=&quot;LinkButton2_Click&quot;&gt;Pick Date&lt;/asp:LinkButton&gt; &amp;nbsp;&lt;asp:Calendar ID=&quot;Calendar2&quot; runat=&quot;server&quot; onselectionchanged=&quot;Calendar2_SelectionChanged&quot; Visible=&quot;False&quot;&gt; &lt;/asp:Calendar&gt;</pre> <p></p> 2012-04-19T02:33:20-04:004940155http://forums.asp.net/p/1794461/4940155.aspx/1?Re+Sort+result+from+given+period+of+time+using+Calendar+Re: Sort result from given period of time using Calendar. <p><em><strong>SQLQUERY</strong></em></p> <p>SELECT *</p> <p>FROM</p> <p><em><strong>YOURTABLENAME</strong></em></p> <p>WHERE</p> <p><span size="2" style="font-size:small"><em><strong><span color="#ff00ff" style="color:#ff00ff">YOURDBDATE</span></strong></em>&nbsp;</span><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">between</span></span><span size="2" style="font-size:small"> </span><span color="#ff00ff" size="2" style="color:#ff00ff; font-size:small"><span color="#ff00ff" size="2" style="color:#ff00ff; font-size:small">convert</span></span><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">(</span></span><span color="#0000ff" size="2" style="color:#0000ff; font-size:small"><span color="#0000ff" size="2" style="color:#0000ff; font-size:small">datetime</span></span><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">,<em><strong>YOURFROMDATE</strong></em></span></span><span size="2" style="font-size:small"> </span><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">,</span></span><span size="2" style="font-size:small"> 105</span><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">)</span></span><span size="2" style="font-size:small"> </span><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">and</span></span><span size="2" style="font-size:small"> </span><span color="#ff00ff" size="2" style="color:#ff00ff; font-size:small"><span color="#ff00ff" size="2" style="color:#ff00ff; font-size:small">convert</span></span><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">(</span></span><span color="#0000ff" size="2" style="color:#0000ff; font-size:small"><span color="#0000ff" size="2" style="color:#0000ff; font-size:small">datetime</span></span><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">,</span></span><em><strong><span size="2" style="font-size:small"> YOURTODATE</span></strong></em><span color="#808080" size="2" style="color:#808080; font-size:small"><span color="#808080" size="2" style="color:#808080; font-size:small">,</span></span><span size="2" style="font-size:small"> 105)</span></p> <p><span size="2" style="font-size:small">ORDER BY <em><strong>DBFIELD ---FOR SORTING BY ASCENDING OR DESCENDING</strong></em></span></p> <p><span color="#808080" size="2" style="color:#808080; font-size:small"></span></p> <p></p> 2012-04-19T06:05:36-04:00