• 0

C# Create XML, has extra slash


Question

Hello gang,

 

I am creating an xml document from data from a database.  However when I write them as an attribute it gets an extra slash

<Trend Ident=\"1\" Info=\"Test1\" />

The database has only "Test1"

 

The code is as follows:

                while (drGet.Read())
                {
                    XmlElement Trend = xmlTrending.CreateElement("Trend");
                    Trend.SetAttribute("Ident", drGet.GetInt32(0).ToString());
                    Trend.SetAttribute("Info", drGet.GetString(1));
                    Trends.AppendChild(Trend);
                }

Thanks

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

I believe drGet is a data row object (or a collection of DataRow).

 

Depending on the DB provider, is it possible you're being provided escape characters in the returned data?

Link to comment
Share on other sites

This topic is now closed to further replies.