MWT
1/23/2008 12:55:00 AM
Serialize dataset:
MemoryStream stream = new MemoryStream();
dataset.WriteXml(stream, XmlWriteMode.DiffGram );
stream.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(stream);
datasetstring = sr.ReadToEnd();
this is the datastring:
â??<diffgr:diffgram xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\"
xmlns:diffgr=\"urn:schemas-microsoft-com:xml-diffgram-v1\">\r\n
<NewDataSet>\r\n <Table1 diffgr:id=\"Table11\" msdata:rowOrder=\"0\"
diffgr:hasChanges=\"modified\">\r\n <ID>1</ID>\r\n
<NUMMER>1001</NUMMER>\r\n <ACHTERNAAM>Changed</ACHTERNAAM>\r\n
</Table1>\r\n </NewDataSet>\r\n <diffgr:before>\r\n <Table1
diffgr:id=\"Table11\" msdata:rowOrder=\"0\">\r\n <ID>1</ID>\r\n
<NUMMER>1001</NUMMER>\r\n <ACHTERNAAM>BlaBla</ACHTERNAAM>\r\n
</Table1>\r\n </diffgr:before>\r\n</diffgr:diffgram>"
Now deserialize:
//--deserialize
StringReader stringReader = new
StringReader(datasetstring);
DataSet ds = new DataSet();
ds.ReadXml(stringReader,XmlReadMode.DiffGram );
Now dataset ds is empty, what am I doing wrong ?
I use VS2008