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

Powered by ScribeFire.