Create XML String from DataView?
Posted on 2007-04-02
Using VWD 2005 and SQL 2005
What started out to be a quick and dirty tool has proved to be quite a distraction for me. I have a need to retrieve records from a stored procedure, serialize them into XML and run a transformation on them with an XSL.
My first thought was to create a DAL. So, using the dataset wizard I made a data object with one method to retrieve records with a parameter.
Next I dropped an XML object onto my web form. I set the TransformationSource property to my XSL stylesheet and my thought was to set the DocumentContent property to an XML string.
Where was the XML content to come from? I knew that the dataset has the GetXML method. However, the DAL tableadapters return a datatable. I can make a dataview from that, but that doesn't really help either.
I know that I can just code this by hand in a few minutes and get the XML from a dataset, but like I said - this really got me distracted - and I was wondering if there was a way to serialize the contents of the datatable or dataview that is returned.