Friday, February 27, 2009

How to store XMLdocument @MSSQL 2005 as xml by using XSD

I was looking for a fast path to store XML in MSSQL 2005 by using XSD + VS2005.
For making life easier I created a stored procedure and imported it to Dataset:

I'm posting this code for other people which are looking for the fast solution:
MemoryStream xmlStream = new MemoryStream();
xmlDoc.Save(xmlStream);
SqlXml sqlXml = new SqlXml(xmlStream);
//here comes a table adaptor //
tblXYZTableAdapter xyzTableAdaptor = new tblXYZTableAdapter();
xyzTableAdaptor.SP_StoreProceure(sqlXml);

2 comments:

pkaayaa said...

This was really very helpful ...
I searched everywhere for hours....

pkaayaa said...

This was really very helpful ...
I searched everywhere for hours....