I used DataSet to load a schema from following xml file;
<node id="0">
<node id="1"/>
</node>
Then I cleared this dataset and filled data in. When I tried to invoke WriteXml method of my dataset, it threw a exception said:
Cannot proceed with serializing DataTable “node”. It contains a DataRow which has multiple parent rows on the same Foreign Key.
But I am so sure that there is no multiple parent rows in my data. Some one said I shoud set dataset’s EnforceConstraints as false but it didn’t work.
Is there any other solution?
DataSet is specifically for data that matches a relational-style schema. For all other XML work, you should use one of the XML APIs, such as LINQ to XML (XElement), XmlReader, XmlDocument, or XPathDocument.