CRecordset fails in RFX_Date with dates 1900-01-01  
Author Message
Kaze





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

We are converting from Visual C++ .Net 2003 to Visual C++ .Net 2005. With our source code as compiled with 2003, we were having no problems reading one of our ODBC database tables. The problem has come in with Visual C++ 2005, where now our record classes are crashing for dates of 1900-01-01.

The application errors out in "C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\atltime.inl" on line 197:

ATLASSUME(m_time != -1); // indicates an illegal input time

The colum information is "CONFIGURED_DATE datetime" with a default value of "1/1/1900".

What I am curious about is what changed between Visual Studio .Net 2003 and Visual Studio 2005 which is now causing this error, and how do I fix this. Unfortunately Google as yielded no results, nor has Yahoo or the search engine within the Visual Studio 2005 Documentation.

We are using SQL Server 2000 for the storage server.

Thank you in advanced for any information you may be able to provide.

~Michael Kesler




Visual C++15  
 
 
Ted.





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

it's a bug (a serious one at that)

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx feedbackid=f001951c-aa17-4eba-bbed-e15981250119

You can request a hotfix through PSS or use one of the workarounds mentioned.


 
 
Kaze





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

I believe I must apologize. I forgot to mention that we are using the CTime class, not the COleDateTime class.

This problem was introduced in VS 2005, so is still an issue.



 
 
Ted.





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

From what I understand from the bug report, I believe it may have to do with CRT changes which affect all time-like wrapper classes.
 
 
vbvan





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

I believe I must apologize. I forgot to mention that we are using the CTime class, not the COleDateTime class.

This problem was introduced in VS 2005, so is still an issue.

If you read the url posted by Ted, you'll know this problem is caused by the behavior change in CRT library strftime.c which now in 2005 it will issue exceptions when tm_year <0. So this change will effect all the corresponding code as well as CTime & COleTime.

For example, once I tried to retrieve the filename of the file on the CD using CFile::GetFileName, but unexpectedly received the exception. And finally I found it was just because the file time of that file is invalid (inside GetFileName, CFile calls GetFileStatus which in turn handles the file time) which triggered the exception.


 
 
Ted.





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

The fix is now available as a QFE (hotfix)

see:

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx feedbackid=f001951c-aa17-4eba-bbed-e15981250119

Just call up the Microsoft PSS support line and request a hotfix, and there will be no charge (for US customers the phone number is 1-800-936-4900 - just press the option for developer support then press to get a hotfix, and quote the KB Id mentioned in the link above)

EDIT: just found out that the hotfix has been pulled due to some regressions, and a new one is in the works (the KB id will be DIFFERENT than the one mentioned in the link above).   I'll update this thread when I hear anything more.


 
 
Freudi





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

The thread is a bit old, but I still have this issue even with VS2005 SP1. I have a Database with lots of date-data before 1970 and get always an ATLASSUME(m!=-1) in atltime.inl
It is impossible to debug this code because if i have 1000 records with older dates this assert is thrown 1000 times. I try to open a call again with MS but they say my version (standard edition)
is a academic version and I have to pay 99 $. So there is nothing for free to download.
Any help

Thomas

 
 
Kaze





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

Well, if you don't need the date column you can drop that column from the class. Or, you can treat the date as a string in your class.

Also, we dropped the custom classes of CRecordset in favor of CODBCRecordset from CodeProject, and seem to have less issues.


 
 
jhnnym





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

Does anyone know we have a hot fix yet I got the hotfix for kb id# 919280. The descriptions for that hot fix is "You cannot distribute hotfix versions of the Visual C++ runtime by using Visual C++ 2005 Redistributable Package". This does not match the description of the probme.

Can someone give me the correct KB ID so I can request the hotfix

Thanks,

johnny


 
 
Ted.





PostPosted: Visual C++ General, CRecordset fails in RFX_Date with dates 1900-01-01 Top

this fix has already been included in Visual C++ 2005 Service Pack 1. Just distribute this:

http://www.microsoft.com/downloads/details.aspx FamilyID=200b2fd9-ae1a-4a14-984d-389c36f85647&displaylang=en