tags:

views:

66

answers:

1

I have a DataSet which has one table loaded with data.

When i write out the dataset to xml using the GetXml method of the dataset, i get all the columns in that data table as elements in the xml file.

How do i get the resulting xml with the column values as attributes instead of elements?

The article here trails off without a proper answer

I am using .NET Framework 2.0

A: 

 

foreach(DataColumn dc in dsHR.Tables[0].Columns)
    dc.ColumnMapping = MappingType.Attribute;

Quite simple :)

Nick