B
Brett Hofer
I must be missing something - Im a veteran C++ programmer now working with
C# overall I like the language but find many weird changes... Anyway Im
writing code behind an aspx. In this one C# method I am building an XML
string to be insterted into a database. This string should result in:
<row FIELD1="value1" FIELD2="value2" \>
I am using a string type variable and I cannot get the double quotes to be
added properly I have tried all of the things that are supposed to work such
as:
string sXML;
sXML = "<row ";
// Ive tried this
sXML += "FIELD1=\"value1\" ";
sXML += "FIELD2=\"value2\" \\>";
// and this
sXML += @"FIELD1=""value1"" ";
sXML += @"FIELD2=""value2"" \\>";
// and this
sXML += "FIELD1=\u0022value2\u0022 ";
sXML += "FIELD2=\u0022value2\u0022 \\>";
In all cases when I examine these cases the sXML string and/or the value
inserted into the database results in:
<row FIELD1=\"value1\" FIELD2=\"value2\" \\>
Why are the \ showing up in the result string? Its things like this that
were so straight forward in C++ that drive me nuts in C# what am I missing
?
Brett++
C# overall I like the language but find many weird changes... Anyway Im
writing code behind an aspx. In this one C# method I am building an XML
string to be insterted into a database. This string should result in:
<row FIELD1="value1" FIELD2="value2" \>
I am using a string type variable and I cannot get the double quotes to be
added properly I have tried all of the things that are supposed to work such
as:
string sXML;
sXML = "<row ";
// Ive tried this
sXML += "FIELD1=\"value1\" ";
sXML += "FIELD2=\"value2\" \\>";
// and this
sXML += @"FIELD1=""value1"" ";
sXML += @"FIELD2=""value2"" \\>";
// and this
sXML += "FIELD1=\u0022value2\u0022 ";
sXML += "FIELD2=\u0022value2\u0022 \\>";
In all cases when I examine these cases the sXML string and/or the value
inserted into the database results in:
<row FIELD1=\"value1\" FIELD2=\"value2\" \\>
Why are the \ showing up in the result string? Its things like this that
were so straight forward in C++ that drive me nuts in C# what am I missing
?
Brett++