Thursday, June 14, 2007

Serializing DataSet with DateTime column in .NET

When you try to serialize a dataset with a DateTime column, it will be serialized with TimeZone information, In .NET v1.0, v1.1 there is no easy work around other than controlling serialization process. Check here



But in .NET v2.0, Microsoft has added a property called DateTimeMode, here you can control the timezone off set value during the serialization. Check here



So, I tried with a typed dataset with DateTimeMode as Unspecified, unfortunately it was setting the timezone value. After couple of hours of invetigation, I found there is a bug in XSD.EXE tool.



To solve this issue, dynamically set the DateTimeMode property or modify XSD.ext generated typed dataset code.



Links I found useful



http://www.codeproject.com/csharp/datetimeissuexmlser.asp

http://blogs.msdn.com/brada/archive/2004/04/13/112784.aspx

http://dotnetjunkies.com/WebLog/saarc/archive/2004/09/20/26119.aspx

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=96118





Powered by ScribeFire.

0 Comments :