>The source code for COleDateTime in 6.0 reads:
>
[quoted text clipped - 8 lines]
> return( m_dt );
>}
Paolo,
FWIW, it's currently the same in the VS2005 pre-release version.
>Shall I change the server side (i.e. avoid setting the status of COleDateTime to COleDateTime::null) or the client side (i.e. return zero when the status is COleDateTime::null) ?
>Is zero the same as a "null" datetime? How can my clients tell a missing date from a "zero" date? I don't want them to display "midnight, 30 December 1899"!
I'm really not sure what to recommend as your best course of action.
Zero isn't the same as a null datetime.
This isn't something I've come across (never doing anything with
databases). The best I can recommend is to check the status yourself
and code around the difference appropriately. If you feel that the
current behaviour is wrong by design, I suggest that you contact MS
product support (by telephone) and raise the issue with them. If you
make your case well enough, maybe it'll be changed for VS2005.
Dave
Paolo - 23 Jun 2004 07:54 GMT
> >ATLCOMTIME_INLINE COleDateTime::operator DATE() const throw()
> >{
[quoted text clipped - 4 lines]
> I'm really not sure what to recommend as your best course of action.
> Zero isn't the same as a null datetime.
You're quite right. I did some digging, and discovered that with the previous version (compiled with VC++6.0), a "null" date was silently converted into a zero date. Clients (in our case, Visual Basic clients) can't tell zero from null, unless you use a VARIANT instead of a DATE. But I can't use a VARIANT, as a COM interface cannot be changed. I can see only one solution: explicitly use a zero date - and document that, in our application, a zero date means no date (Most of our clients assume that already). Can you figure a factory job that starts on January 1, 1900 ? :)
> If you feel that the
> current behaviour is wrong by design, I suggest that you contact MS
> product support (by telephone) and raise the issue with them. If you
> make your case well enough, maybe it'll be changed for VS2005.
No, that's OK, now I've got it: the assert is there to warn you: "hey, programmer, remember that DATE cannot represent null, unpredictable trouble may occur!!!".
But I think it should have been documented in MSDN -- It would have saved me from this headache!
Thank you very much for your reply
Paolo
Ronald Laeremans [MSFT] - 23 Jun 2004 19:45 GMT
I agree, I'll see what we can do for the 8.0 documentation to make this
clear.
Ronald Laeremans
Visual C++ team
>> >ATLCOMTIME_INLINE COleDateTime::operator DATE() const throw()
>> >{
[quoted text clipped - 27 lines]
> Thank you very much for your reply
> Paolo