Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I'm working on .NET framework 3.5. I've created a System.Xml.XmlDocument in my code. I wanna execute a stored procedure that takes this xml doc as a parameter and inserts it into sql server database table. The datatype of the column is "xml"
I don't know how to perform this insert operation within the stored procedure. I'm getting the following error if I try to insert it just like we insert a normal field.

"Error calling stored procedure ins_xml: Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Data.SqlClient.SqlParameter'."

Please help me..
Thanks in advance,
Vanathi
Posted

You can just use xml's OuterXml property
 
Share this answer
 
Comments
Vanathi.A 6-Dec-10 2:27am    
Thank you!!!
 
Share this answer
 
v3
Comments
thatraja 6-Dec-10 3:19am    
Hi, Use link option in answer text area while you want to include any links in your answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900