Solved

Problem with & when using a web service

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

815 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

7 Experts available now in Live!

Get 1:1 Help Now