开发者

how to handel XML datatype in Datatable while inserting Data through SqlBulkCopy for sql server?

In my application i want to insert XML document in t开发者_高级运维o 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,


Try sending the xml as string type

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜