查看类CCADOField的value方法找到问题所在,下面是MSDN上关于COMVariant的Date方法的Remark:
A
COMVariant
object has a date and time data type if its data type is set to COMVariantType::VT_DATE
. When you set the value of the object, you must set the time part of the value in addition to the date. To set the time part of the value, use the time
property. 它特意提到如果类型是COMVariantType::VT_DATE,那么这个COMVariant对象会有Date和Time两部分组成,分别通过Date和Time方法得到,而在CCADOField的value方法中,关于日期的类型:
return value.date();
return DateTimeUtil::newDateTime(value.date(),value.time());