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.
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?
NIthya Natha...
Member
6 Points
59 Posts
Sort result from given period of time using Calendar.
Apr 19, 2012 02:33 AM|LINK
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.
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?
Below are the .aspx code for the two textboxes:
From: <asp:TextBox ID="from" runat="server"></asp:TextBox> <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">Pick Date</asp:LinkButton> <asp:Calendar ID="Calendar1" runat="server" onselectionchanged="Calendar1_SelectionChanged" TitleFormat="Month" Visible="False"></asp:Calendar> To: <asp:TextBox ID="to" runat="server"></asp:TextBox> <asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">Pick Date</asp:LinkButton> <asp:Calendar ID="Calendar2" runat="server" onselectionchanged="Calendar2_SelectionChanged" Visible="False"> </asp:Calendar>prashantdigh...
Member
101 Points
56 Posts
Re: Sort result from given period of time using Calendar.
Apr 19, 2012 06:05 AM|LINK
SQLQUERY
SELECT *
FROM
YOURTABLENAME
WHERE
YOURDBDATE between convert(datetime,YOURFROMDATE , 105) and convert(datetime, YOURTODATE, 105)
ORDER BY DBFIELD ---FOR SORTING BY ASCENDING OR DESCENDING