Solved

Problem with & when using a web service

Posted on 2009-04-02
5
240 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

910 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

21 Experts available now in Live!

Get 1:1 Help Now