Search code examples
c#xmldatasetdataviewdatarowview

DataRowVersion not working when using DataSet.ReadXML(...) to load data


So I've spent all day finding where the problem lies. If I don't use XML to load data into my DataSet (i.e. just grab it straight from a database or somesuch) then I have no problems at all.

However, I have to read it from an XML file and I am currently using DataSet.ReadXML(...) to achieve this. The XML has been written using DataSet.writeXML (before being transmitted over the wire by a WCF service).

Here is how it is loaded:

XmlTextReader xmlreader = new XmlTextReader(odhdotnet.GetAllMetadataXML(), XmlNodeType.Element, null);
AllData.ReadXml(xmlreader);

Using a DataSet with data loaded from XML breaks all DataView.RowStateFilter functionality.

DataViewRowState.ModifiedCurrent does not result in a view of all the modified rows because the rows never have their RowVersion set to anything other than 'current'.

I do not know what is going on here, or why it is happening. Any ideas? My feeling is that by loading the data via XML the DataSet for some reason is missing something?

Any help most appreciated!

Kind regards, Fugu


Solution

  • Have you tried setting the XmlWriteMode to XmlWriteMode.DiffGram?