开发者

How to move DateTime to and from XML and Dataset

开发者 https://www.devze.com 2023-03-31 07:28 出处:网络
How can I make sure that when I write a DateTime value to an xml file from a dataset with dataset.WriteXml,

How can I make sure that when I write a DateTime value to an xml file from a dataset with dataset.WriteXml, I can subsequently retrieve a DateTime into a new dataset using dataset.ReadXm开发者_如何转开发l. At the moment I appear to get a String holding the date and time.

Any thoughts Richard


When you write the XML, use the overloaded function with XmlWriteMode.WriteSchema. That should preserve your types when you serialize and deserialize.

DataSet1.WriteXml(fileName, XmlWriteMode.WriteSchema);
0

精彩评论

暂无评论...
验证码 换一张
取 消