ReadXML raise exception "String was not recognized as a valid DateTime"

XML schema:
<xs:element name="DateGenerated" type="xs:dateTime" minOccurs="0" />

XML file is:
<DateGenerated>27/12/2007 10:46:02 AMDateGenerated>

VB code:
dsControlFile.ReadXml(controlFileName)

The default format of datetime is like "2002-05-30T09:00:00".
However my datetime string is like "27/12/2007 10:46:02 AM".

Solution:

If we want to use ReadXML, we have to make sure datetime string is in fixed standard format "YYYY-MM-DDThh:mm:ss".

So finally what i did is to change datetime to string.

转载于:https://www.cnblogs.com/yangbin990/archive/2007/12/27/1016338.html

你可能感兴趣的:(ReadXML raise exception "String was not recognized as a valid DateTime")