Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How can I filter a date range in Classic ASP?

Author  Topic 

Shelby
Starting Member

3 Posts

Posted - 2008-02-21 : 21:15:28
I have a Classic ASP page that provides me a view on Orders posted by customer for a selected month and year from a SQL Server 2000 database. This ASP page has a Stored Procedure that returns the orders posted by month and year. However, my needs are to be able to display the view by month, day and year to month, day and year, For example January 15, 2008 to February 14, 2008.

The current Classic ASP page has a dropdown to select the month and year from this dropdown only displays months and years for the months and years the customer had posted orders.

What I’d like to know is how to add to the classic asp page the means to input a date range on the fly that would return the report by month, day, year to month, day, year.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-21 : 23:04:30
change the dropdowns to inputboxes so that it can recieve the input in desired format. provide appropriate client side validations to check if imput is in your desired format. Then pass this to db to retrieve the results.
Go to Top of Page

Shelby
Starting Member

3 Posts

Posted - 2008-02-22 : 00:02:50
Vidakh16,
Thanks for the reply...

Now, my Stored Procedure select looks like the following, would you or someone know the format for adding day(s) to the Stored Procedure?

SELECT
DATEPART(mm, Orders.dtDateConfirmed) AS month,
DATEPART(yyyy, Orders.dtDateConfirmed) AS year
FROM Orders
INNER JOIN PickList ON Orders.nOrderId = PickList.nOrderId
WHERE(Orders.nCreatingCorpId = @iAccount) AND (Orders.dtDateConfirmed IS NOT NULL)
GROUP BY DATEPART(mm, Orders.dtDateConfirmed), DATEPART(yyyy, Orders.dtDateConfirmed)
ORDER BY DATEPART(yyyy, Orders.dtDateConfirmed) desc, DATEPART(mm, Orders.dtDateConfirmed) desc
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-22 : 00:56:49
quote:
Originally posted by Shelby

Vidakh16,
Thanks for the reply...

Now, my Stored Procedure select looks like the following, would you or someone know the format for adding day(s) to the Stored Procedure?

SELECT
DATEPART(mm, Orders.dtDateConfirmed) AS month,
DATEPART(yyyy, Orders.dtDateConfirmed) AS year,
DATEPART(day,Orders.dtDateConfirmed) AS day
FROM Orders
INNER JOIN PickList ON Orders.nOrderId = PickList.nOrderId
WHERE(Orders.nCreatingCorpId = @iAccount) AND (Orders.dtDateConfirmed IS NOT NULL)
GROUP BY DATEPART(mm, Orders.dtDateConfirmed), DATEPART(yyyy, Orders.dtDateConfirmed)
ORDER BY DATEPART(yyyy, Orders.dtDateConfirmed) desc, DATEPART(mm, Orders.dtDateConfirmed) desc



is this wat you're looking at?Why are grouping the data?
Go to Top of Page

Shelby
Starting Member

3 Posts

Posted - 2008-02-22 : 01:31:11
I hope what you gave me is what I’m looking for. I’ll try it. Don’t know why I’m grouping yet.
This is my first attempt at doing this and I’m working on a pre-existing Classic ASP page. I have very limited skills at this time but a whole lot of passion to figure this out and make it work by month, day, year to month, day, year. I appreciate the help.

Now I see I have to edit the Classic ASP page to add the input boxes and day can you help me there?

<tr>
<td>Activity for the month of:</td>
<td><select name="moyr">
<%
Do While Not rsShipperActivityMonthYear.EOF
%>
<option value="<%=rsShipperActivityMonthYear("month") & ":" & rsShipperActivityMonthYear("year")%>"><%=MonthName(rsShipperActivityMonthYear("month")) & " " & rsShipperActivityMonthYear("year")%></option>
<%
rsShipperActivityMonthYear.MoveNext

Loop

Set rsShipperActivityMonthYear = Nothing
%>
</select>
</td>
<td><input type="submit" name="go_moyr" value="Go"></td>
</tr>
Go to Top of Page
   

- Advertisement -