rgeiman
asked on
How can I read in a date from a database???
I can read in fields of all types (CString, int, etc) in a database, but I cannot get the dates (AppWiz defined the date as CTime in the CRecordset derived class) to work properly. Anyone have any suggestions please?? BTW, I'm using Access 97 and Visual C++ 6.0
ASKER
Adjusted points to 150
Just guessing ... Try changing the type to COleDateTime ( i think Access uses the OLE DATE
type, which must be mapped to COleDateTime instead of CTime, but i am not sure).
type, which must be mapped to COleDateTime instead of CTime, but i am not sure).
ASKER
Edited text of question
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It's O.K. to use CTime. I have used it with CRecordsets.
CTime gives problems (usually invalid memory reference) when the object is not initialized and the database defaults to one (say to Now()). Try initializing your CTime object to either 0 or CTime::GetCurrentTime(). Basically, initialize it to some value !
CTime gives problems (usually invalid memory reference) when the object is not initialized and the database defaults to one (say to Now()). Try initializing your CTime object to either 0 or CTime::GetCurrentTime(). Basically, initialize it to some value !
ASKER