Basically I have a asp.net that I need to display an XML document (straight xml, with the tree nodes) I have the sql statement which returns the row names and each one of their values. Just wondering how I should go about doing this?
SQL Server 2008, my query is just a select * from offices, my results is “1”,”New York”,”New York City”,”555-5555″ I would like the output to be
<item id="1">
<state>New York</state>
<city>New York City</city>
<phone>555-5555</phone>
</item>
where state/city/phone is the column name, and the value is the value of that column
You can select your query into a DataSet:
(Taken from MSDN)
Then, you can write that DataSet to an XML string:
View the MSDN pages for more options.