Wednesday, October 13, 2010

Convert XML string into SQL XML object

How to convert the xml string into sqlxml 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