Avatar of sparky74
sparky74

asked on 

Replace SQL String Characters with html Entity Number

I need some help on how i can replace the following characters in my sql string

I need to change these

& needs to be replaced by &#38
£  needs to be replaced by &#163
 ¯ needs to be replaced by &#175  (this is spacer not hyphen)
: needs to be replaced by &#58

I have added my code below...

each of these line could contain the characters above

newTextAd.headline = Dr["adtitle"].ToString();
newTextAd.description1 = Dr["adline1"].ToString();
newTextAd.description2 = Dr["adline2"].ToString();
newTextAd.displayUrl = Dr["displayurl"].ToString();
newTextAd.destinationUrl = Dr["adlink"].ToString();


hope you can advise





dsResults = DBManager.GetAllThomasDetails("Select * from Thomas where (isUpdated = 1) or (StatusUpdated = 1)");
 
if (Dr["textAdID"] == DBNull.Value)
                {
                    newTextAd.headline = Dr["adtitle"].ToString();
                    newTextAd.description1 = Dr["adline1"].ToString();
                    newTextAd.description2 = Dr["adline2"].ToString();
                    newTextAd.displayUrl = Dr["displayurl"].ToString();
                    newTextAd.destinationUrl = Dr["adlink"].ToString();
                    newTextAd.adGroupId = groupID;
                    myAds = adService.addAds(new Ad[] { newTextAd });

Open in new window

.NET ProgrammingASP.NETSQL

Avatar of undefined
Last Comment
sparky74

8/22/2022 - Mon