In my application, I want to insert an XML document into my table that has a column with an XML data type. Now the problem occurs when I use SqlBulkCopy in my application. I need to pass the Datatable to SqlBulkCopy.WriteToServer method. it shows me an InvalidCastException. To store the XML data in a datatable, I tried to use the Datatype DataColumn property and set it to XmlReader (did not work), XElement (did not work) and a line that shows an InvalidCastException.
So, I want to know what data type I should specify for a DataColumn so that data can be inserted using sqlbulkcopy.
Thank,
source
share