XML : Insert XML as string into SQL column

I have a C# website that I need the ability to insert XML into a database column directly from a form field just as a string. I don't want to extract values from the XML, I simply want to insert the XML as-is as a string.

This currently causes my code to choke.

Code:

  objParameter.Add(new SqlParameter("@Description", txtDesc.Text.Trim()));    

Text from form field:

  <note>  <to>Me</to>  <from>You</from>  <heading>Reminder</heading>  <body>Don't forget to buy milk.</body>  </note>    

No comments:

Post a Comment