sydneyguy
asked on
c# sql server retuning an extr \ when a " is found
have a data base sql server that i am running the records from , and one of the fields that is returned will hold the data of .... <iabc-type="ppub"> ..... but when its returned it comes back as "<iabc-type=\"ppub\">" with the extra \ in the code which it will not find in the text file that it is looking for, because i am looking for <iabc-type="ppub"> instead of
"<iabc-type=\"ppub\">" any ideas on what i can put into the data base field to stop these \ from being returned every time it hits a " mark
"<iabc-type=\"ppub\">" any ideas on what i can put into the data base field to stop these \ from being returned every time it hits a " mark
ASKER
not sure if its a sql server problem or a c# return problem
in the field in the sql server 2005 table i have the text
<iabc-type="nlm-ta">
but after i read in the field by a dt = readrec("select * from tblSearchTerms");
the returned string is "<iabc-type=\"nlm-ta\">
and i need to get rid of the \ in the returned string, so either i need to take it out in the field or the returned string
also using studios 2005
in the field in the sql server 2005 table i have the text
<iabc-type="nlm-ta">
but after i read in the field by a dt = readrec("select * from tblSearchTerms");
the returned string is "<iabc-type=\"nlm-ta\">
and i need to get rid of the \ in the returned string, so either i need to take it out in the field or the returned string
also using studios 2005
ASKER
you cannot use string replace because it does not like the \ in the function
sqlstringtemp = sqlstringstart.Replace("\" , "");
wil not comnpile
sqlstringtemp = sqlstringstart.Replace("\"
wil not comnpile
then change your data in sql server as
<iabc-type=\"nlm-ta\">
or use following in c#
sqlstringtemp = sqlstringstart.Replace("\" ", "\\\"");
<iabc-type=\"nlm-ta\">
or use following in c#
sqlstringtemp = sqlstringstart.Replace("\"
ASKER
sqlstringtemp = sqlstringstart.Replace("\" ", "\\\"");
line changes to which is not workable
<iabc-type=\\\"nlm-ta\\\">
<iabc-type=\"nlm-ta\"> in the data base returns
<iabc-type=\\\"nlm-ta\\\">
which also is no good as i need to get rid of the \ not increase the numbers for the string
line changes to which is not workable
<iabc-type=\\\"nlm-ta\\\">
<iabc-type=\"nlm-ta\"> in the data base returns
<iabc-type=\\\"nlm-ta\\\">
which also is no good as i need to get rid of the \ not increase the numbers for the string
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yes you were right when i run and not worry about them the code woks just fine bit of a furphy
thanks for the imput
posted the points for how much input you put into the question
thanks
garry
thanks for the imput
posted the points for how much input you put into the question
thanks
garry
In c# back slash \ is escape sequence speifier. and double qoutation " is special character too.
if you need \ then specify \\ twice or use @ to make string to be used as it is.
thereofr check that your data in sql server has the related data. please also specify sql server verion and also add it in the zone
Thanks