Solved

Problem with & when using a web service

Posted on 2009-04-02
5
239 Views
Last Modified: 2012-05-06
I am using third party webservice to create records.

I read in from database this title

   "Customers & Records"

    However the webservice writes to database as

    "Customers & invoices"

notice it adds      "&"     instead of &

What is the best way around this?  I want it to write "&" as oppose to "&"


In my code I have  

customercategory thiscategory = new customercategory();
thiscategory.title = /////read in tite from database



0
Comment
Question by:mugsey
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:VikramMullick
ID: 24047788
try using && instead of &
0
 

Author Comment

by:mugsey
ID: 24047795
Thanks but I cannot modify the database table I am reading from
0
 
LVL 9

Expert Comment

by:VikramMullick
ID: 24047817
I guess you might be using dataset/datatable for fetching data .
Then try to replace/append the & symbol and then send it to webservice.
0
 

Author Comment

by:mugsey
ID: 24047853
Yes I have been doing that with string.replace  but I need the "&" to be preserved
0
 
LVL 1

Accepted Solution

by:
Prodige earned 500 total points
ID: 24047875
It appears the problem is not so much with the fetching. The problem lies in how the web service communicates with the database. Posting via the webservice will adjust the input data to be a valid soap message and converts your & to the html / xml equivalent of & but it does not appear to be converting it back to an & when it hits the db.

If you have no access to the see what the web service is doing then you either have to search and replace the "&" with "and" or try using the url safe version which is "%26", last resort would be to try and use the hex version "#26"
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now