Insert into XML column

  • Thread starter Thread starter Mervin
  • Start date Start date
M

Mervin

Can anyone provide sample code for simply inserting the xml from an XDocument
into a XML column in SQL Server?

Thanks in advance.
 
I discovered the answer. If using a SqlDataSource on a FormView, within the
..aspx page change the Parameter type from Object to String. Then, set the
value of the XML column to the string of the XDocument value:

XDocument responseXML = XDocument.Load(tr);
e.Values["Response_Xml"] = responseXML.ToString();

Mervin
 
Back
Top