I\'m trying to insert into XML column (SQL SERVER 2008 R2), but the server\'s complaining:
System.Data.SqlClient.SqlException (0x80131904):
XML
Default encoding for a xml serializer should be UTF-16. Just to make sure you can try -
XmlSerializer serializer = new XmlSerializer(typeof(YourObject));
// create a MemoryStream here, we are just working
// exclusively in memory
System.IO.Stream stream = new System.IO.MemoryStream();
// The XmlTextWriter takes a stream and encoding
// as one of its constructors
System.Xml.XmlTextWriter xtWriter = new System.Xml.XmlTextWriter(stream, Encoding.UTF16);
serializer.Serialize(xtWriter, yourObjectInstance);
xtWriter.Flush();