Getting hierarchical (nested) data from DataSets

The other day I was struggling with generating XML data from a database I was working with. After talking with a co-worker, he mentioned using Transact-SQL and the “For XML Explicit” options related to a query. So I looked at how to accomplish this task using the .NET Framework.