Friday, November 28, 2014

How to Convert XML string into SQL XML object

Convert XML string into SQL XML object



Create a proc in the Data base like..

create proc InsertXMLValue 
(@XMLString XML)
as
begin

-- Code to insert into the specific table which actually have the XML datatype column
end
And call this proc from the applicatio, use the SQL command object to call this proc and create a parameter like...
SqlParameter
 sqlParam = new SqlParameter("@XMLString"SqlDbType.Xml);
sqlParam.Value = strXML;
Pass the string value to the strXML variable.

No comments:

Post a Comment