ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 7th, 2003, 10:28 AM
gotspy's Avatar
gotspy gotspy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Buffalo, NY
Posts: 156 gotspy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 59 m 53 sec
Reputation Power: 6
Passing URL date variables

I'm a PHP programmer, not ASP so this may be a very simple question:

I am trying to pass two variables to an ASP page so I can display a coresponding crystal report. The variables are start_date and end_date. Here is the code:

--== <index.html - Start> ==--

<form method="get" action="display.asp">
Date Range: From <input type="text" name="start_date" value="2/1/03"> To <input type="text" name="end_date" value="2/1/03"><br>
<input type="submit" value="Display"> <input type="reset" value="Reset">
</form>

--== <index.html - end> ==--

--== <display.asp - start> ==--
Set StartDate = request.QUERY_STRING("start_date")
Set EndDate = request.QUERY_STRING("end_date")
Session("oRpt").ParameterFields.GetItemByName("Start_Date").AddCurrentValue(CDate("StartDate"))
Session("oRpt").ParameterFields.GetItemByName("End_Date").AddCurrentValue(CDate("EndDate"))
--== <display.asp - end> ==--

I know so little about ASP that I can't even get it to display on the page to make sure the variables are being passed properly.

Any help would be appreciated!
__________________
Forget Milk!
Gotspy?

www.gotspy.com

Reply With Quote
  #2  
Old April 7th, 2003, 03:20 PM
defjamninja defjamninja is offline
Overly white
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Fresno, CA
Posts: 83 defjamninja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
--== <display.asp - start> ==--
Set StartDate = request.QUERY_STRING("start_date")
Set EndDate = request.QUERY_STRING("end_date")
Session("oRpt").ParameterFields.GetItemByName("Start_Date").AddCurrentValue(CDate("StartDate"))
Session("oRpt").ParameterFields.GetItemByName("End_Date").AddCurrentValue(CDate("EndDate"))
--== <display.asp - end> ==--


I think all you need to do is remove the sets. So you should just have this
Code:
--== <display.asp - start> ==--
StartDate = request.QUERY_STRING("start_date")
EndDate = request.QUERY_STRING("end_date")
Session("oRpt").ParameterFields.GetItemByName("Start_Date").AddCurrentValue(CDate("StartDate"))
Session("oRpt").ParameterFields.GetItemByName("End_Date").AddCurrentValue(CDate("EndDate"))
--== <display.asp - end> ==--

Reply With Quote
  #3  
Old April 8th, 2003, 08:16 AM
gotspy's Avatar
gotspy gotspy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Buffalo, NY
Posts: 156 gotspy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 59 m 53 sec
Reputation Power: 6
I removed the sets and got the same thing.

I did notice however that the date that is getting passed in the URL is:

display.asp?start_date=3%2F1%2F03&end_date=3%2F30%2F03

I need it to get converted back to:

display.asp?start_date=3/1/03&end_date=3/30/03

How would I replace "%2F" with "/"?

I guess this is asking two seperate questions?

Reply With Quote
  #4  
Old April 8th, 2003, 08:58 AM
Wingman Wingman is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Bavaria, Germany
Posts: 140 Wingman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 40 m 41 sec
Reputation Power: 6
You don't need to decode those chars, if you access your parameters via Request.QueryString("start_date") those % thingies will be decoded and you get your original format.

Reply With Quote
  #5  
Old April 8th, 2003, 12:36 PM
gotspy's Avatar
gotspy gotspy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Buffalo, NY
Posts: 156 gotspy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 59 m 53 sec
Reputation Power: 6
Well so much for that idea. Thanks for the info.

This is to serve a Crystal Report, I'm going to give them a call in a little bit and see what they say. Thanks for the help.

I will post the answer if I get one.

Reply With Quote
  #6  
Old April 8th, 2003, 02:51 PM
gotspy's Avatar
gotspy gotspy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Buffalo, NY
Posts: 156 gotspy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 59 m 53 sec
Reputation Power: 6
And the answer is...

Set StartDate = request.QUERYSTRING("start_date")
Set EndDate = request.QUERYSTRING("end_date")
Session("oRpt").ParameterFields.GetItemByName("Start_Date").AddCurrentValue(CDate(StartDate))
Session("oRpt").ParameterFields.GetItemByName("End_Date").AddCurrentValue(CDate(EndDate))

Take the _ out of QUERY_STRING and remove the "" from the (CDATE("EndDate"))

Thanks for the help.

Reply With Quote
  #7  
Old April 8th, 2003, 03:15 PM
defjamninja defjamninja is offline
Overly white
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Fresno, CA
Posts: 83 defjamninja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
DOH
HA I didn't even see the underscore their.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Passing URL date variables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway