DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

Issue with ampersand &

This is a discussion on Issue with ampersand & within the ASP Development forums, part of the Programming & Scripting category; Hi All, I have a field "Status" where some of the data is: -In R&M This is the status field ...

Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

  1 links from elsewhere to this Post. Click to view. #1  
Old April 17th, 2008, 09:54 AM
Rebelle's Avatar
Barn Loyal
 
Join Date: Mar 2008
Posts: 748
Rep Power: 2
Rebelle will become famous soon enough
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.
  #2  
Old April 17th, 2008, 10:02 AM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,962
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
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.

If you like it here...throw us a few bones to help
support us.

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
Barn Loyal
 
Join Date: Mar 2008
Posts: 748
Rep Power: 2
Rebelle will become famous soon enough
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
Administrator
 
Join Date: Mar 2008
Real name: Rich
Location: Somewhere only we know...
Posts: 1,342
Blog Entries: 6
Rep Power: 8
richyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to allrichyrich is a name known to all
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


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 06:20 PM.


Copyright ©2008-2010, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2