Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "Issue with ampersand &" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). The Classic ASP forum is for ASP/VBScript and ASP/JScript applications.


Closed Thread « Previous Thread | Next Thread »  
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1  
Old April 17th, 2008, 09:54 AM
Rebelle's Avatar
V.I.P/Donor


 
Join Date: Mar 2008
Posts: 254
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Question Issue with ampersand &

Hi All,

I have a field "Status" where some of the data is:
-In R&M

This is the status field where the data is stored. I can get results when I search the status field using the "In R&M" selection but I'm passing the status when i'm exporting to excel file, like below.

Code:
location.href = "ResultsExcel.asp?RegionName=<%= sRegion %>&District=<%= strDistrict %>&Status=<%= strStatus %>
Here is what I get when I pass to excel but don't get any records only the header info in the file.

Code:
http://server/folder/ResultsExcel.asp?RegionName=&District=&Status=In R&M
I've tried adding this to my resultsexcel.asp but still no luck with returning records.

Code:
strStatus = Replace(Request("Status"),"&","& amp;")
I'm thinking the problem is the & because I have other Status' without the & and those work just fine.

Any help/suggestions is greatly appreciated.
Sponsored Links
  #2  
Old April 17th, 2008, 10:02 AM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 820
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

Default

You need to use Server.UrlEncode() to encode the querystring.
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

Join our Folding team: DeveloperBarn Folding
The Following User Says Thank You to jmurrayhead For This Useful Post:
Rebelle (June 17th, 2008)
  #3  
Old April 17th, 2008, 10:50 AM
Rebelle's Avatar
V.I.P/Donor


 
Join Date: Mar 2008
Posts: 254
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

Thanks JMurrayhead!!!!

Using this now and all seems to be good.

Code:
location.href = "ResultsExcel.asp?RegionName=<%= sRegion %>&District=<%= strDistrict %&Status=<%= Server.UrlEncode(Request("Status")) %>
  #4  
Old April 17th, 2008, 10:54 AM
richyrich's Avatar
Moderator


 
Join Date: Mar 2008
Location: Somewhere only we know...
Posts: 395
Thanks: 26
Thanked 32 Times in 32 Posts
Blog Entries: 1
Rep Power: 1
richyrich will become famous soon enough

Awards Showcase
Classic ASP JavaScript 
Total Awards: 2

Default

Quote:
Originally Posted by jmurrayhead View Post
You need to use Server.UrlEncode() to encode the querystring.
Can't give you rep so I'll just say I agree!
Closed Thread

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.developerbarn.com/asp-development/132-issue-ampersand.html
Posted By For Type Date
DeveloperBarn Forums - ASP Help, ASP.Net Help, PHP Help, SQL Help, Tutorials, Windows Help This thread Refback April 26th, 2008 09:34 AM


All times are GMT -4. The time now is 05:19 PM.



Content Relevant URLs by vBSEO 3.2.0