[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sql server2005 unnecessary characters appended when data retrieved in c#

Posted on 2007-07-25
4
Medium Priority
?
205 Views
Last Modified: 2010-03-19
i have following problem
I enter some data into column of sql server2005 .Then try fetching it using sqlreader in c# using a stored proc.When i try to execute the stored procedure i m getting proper data.
data i m enetring is <table><tr><td><img src="hello.jpg" /></td></tr></table>
and it comes fine when i try in sql server only but when i fetch it in my appliaciton using sqlreader and stored proc.it comes to me as
<table><tr><td><img src=\"hello.jpg\" /></td></tr></table>
So blackslash is getting appended by itself to the double quotes.I am fetching thsi field in string variable
still trying to replace it in code behind using string.replace but it sodesnt allow me to use string.replace("\"",""").
Giving me errors.
can any1 suggest a way that data shud be comming up normaly in c# file than appending these special characters into it.

Thanks
0
Comment
Question by:Devsolutions
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:BurntSky
ID: 19567055
The string you're viewing is actually correct.  You're probably just looking at it in the debugger; the debugger will show the delimiters on quotation characters, but if you actually display the string to the user in some manner, these delimiters will not be visible.
0
 
LVL 1

Author Comment

by:Devsolutions
ID: 19567393
Oh ok,but i am trying to replace the string
encodehtml is having value fetched from database
if (EncodedHTML.Contains("##linkNewsletter##"))
            {
                EncodedHTML.Replace("##linkNewsletter##", "abc");
}
 but its not replacing and going in and then coming out w/o replacing it,dont understand why then,thought this maybe coz i m getting string like that.and probaly probelm is that only
0
 
LVL 9

Accepted Solution

by:
BurntSky earned 2000 total points
ID: 19567435
the Replace method creates a new instance of the string with the value removed.  You need to reassign it to your original variable.  Also, you don't need to check if it contains the string first.

EncodedHTML = EncodedHTML.Replace("##linkNewsletter##", "abc");
0
 
LVL 1

Author Comment

by:Devsolutions
ID: 19567499
HI burntsky.Thanks a lot,yes its working now,
can u please also have a look at another question of mine
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22708192.html
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

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…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

872 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