SQL 2005 and XML Data Type
I was just working with the new XML datatype for SQL 2005 and started getting this error when inserting the value:
XML parsing: line 1, character 45, unable to switch the encoding
I was simply sending a string to a stored proc thinking that would work (it was a string of valid XML)... I was wrong. I did some research and solved the problem by wrapping up the XML String into a SQL XML datatype.
System.Data.SqlTypes.SqlXml xmlSafe = new System.Data.SqlTypes.SqlXml(new System.Xml.XmlTextReader(xmlAsString, System.Xml.XmlNodeType.Document, null));
Sure, it's simple enough but I haven't used the XML type before.
Feedback awaiting moderation
This post has 1 feedback awaiting moderation...
01/22/09 09:59:55 am, 