views:

37

answers:

1

In my application i want to insert XML document in to my table which has a column with XML datatype. Now issue comes when i use SqlBulkCopy in my application. i have to pass a Datatable to SqlBulkCopy.WriteToServer method. it is showing me InvalidCastException. for storing XML data in datatable, I tried to utilize Datatype property of DataColumn and set it to XmlReader (didn't worked), XElement (didn't worked) and string which is showing InvalidCastException.

So I want to know which datatype should i specify for DataColumn so that data can be inserted using sqlbulkcopy.

Thanks,

A: 

Try using string datatype

saurabh