Problem with COleDateTime obj
-
Hi to all, I've got a big problem with the code below CWorkRecordset::CWorkRecordset(CDaoDatabase* pdb) : CDaoRecordset(pdb) { //{{AFX_FIELD_INIT(CWorkRecordset) m_lUser = 1; m_lCode = 0; m_lDept = 0; m_lWork = 0; m_lSource = 0; m_oStartTm = COleDateTime::GetCurrentTime(); m_nFields = 6; //}}AFX_FIELD_INIT m_nDefaultType = dbOpenDynaset; } The problem occours during the creation of the obj, and only if: - I'm running in debug mode - The PC where Visual C++ Professional 6.0 (no service pack) is installed has Win XP as OS Program crashes when it execute: m_oStartTm = COleDateTime::GetCurrentTime(); If I run in release mode, no crash occours If I run in debug/release mode in a Win 2000 PC, no problem The state of obj m_oStartTm is "valid" before assignment Can anybody help me?:confused: Thanks in advance Cristian
-
Hi to all, I've got a big problem with the code below CWorkRecordset::CWorkRecordset(CDaoDatabase* pdb) : CDaoRecordset(pdb) { //{{AFX_FIELD_INIT(CWorkRecordset) m_lUser = 1; m_lCode = 0; m_lDept = 0; m_lWork = 0; m_lSource = 0; m_oStartTm = COleDateTime::GetCurrentTime(); m_nFields = 6; //}}AFX_FIELD_INIT m_nDefaultType = dbOpenDynaset; } The problem occours during the creation of the obj, and only if: - I'm running in debug mode - The PC where Visual C++ Professional 6.0 (no service pack) is installed has Win XP as OS Program crashes when it execute: m_oStartTm = COleDateTime::GetCurrentTime(); If I run in release mode, no crash occours If I run in debug/release mode in a Win 2000 PC, no problem The state of obj m_oStartTm is "valid" before assignment Can anybody help me?:confused: Thanks in advance Cristian
Have you stepped into
COleDateTime::GetCurrentTime()
to see what is causing the crash?
"Take only what you need and leave the land as you found it." - Native American Proverb
-
Have you stepped into
COleDateTime::GetCurrentTime()
to see what is causing the crash?
"Take only what you need and leave the land as you found it." - Native American Proverb
DavidCrow wrote:
Have you stepped into COleDateTime::GetCurrentTime() to see what is causing the crash?
As I try to step into using F11 the program crashes, the debug window says: Debug assertion failed! File: winctrl5.cpp line: 189 Before calling that function obj m_oStartTm.dt = 0.0000 & m_oStartTm.status = valid I don't understand...
-
DavidCrow wrote:
Have you stepped into COleDateTime::GetCurrentTime() to see what is causing the crash?
As I try to step into using F11 the program crashes, the debug window says: Debug assertion failed! File: winctrl5.cpp line: 189 Before calling that function obj m_oStartTm.dt = 0.0000 & m_oStartTm.status = valid I don't understand...
misturas wrote:
File: winctrl5.cpp line: 189
Hmm, this is inside of the
CDateTimeCtrl::GetTime()
method. Can you set a breakpoint in it and then check the call stack once that breakpoint is reached? I'm curious how you got there fromCOleDateTime::GetCurrentTime()
. Another suggestion would be to change the initialization to:m_oStartTm = COleDateTime(0);
and see what that produces. Also, what does
CWorkRecordset::DoFieldExchange()
look like?
"Take only what you need and leave the land as you found it." - Native American Proverb
-
misturas wrote:
File: winctrl5.cpp line: 189
Hmm, this is inside of the
CDateTimeCtrl::GetTime()
method. Can you set a breakpoint in it and then check the call stack once that breakpoint is reached? I'm curious how you got there fromCOleDateTime::GetCurrentTime()
. Another suggestion would be to change the initialization to:m_oStartTm = COleDateTime(0);
and see what that produces. Also, what does
CWorkRecordset::DoFieldExchange()
look like?
"Take only what you need and leave the land as you found it." - Native American Proverb
So, using m_oStartTm = COleDateTime(0); causes a compiling error(0); DoFieldExchange is: pFX->SetFieldType(CDaoFieldExchange::outputColumn); DFX_Long(pFX, _T(cRSsbUser), m_lUser); DFX_Long(pFX, _T(cRSsbCode), m_lCode); DFX_Long(pFX, _T(cRSsbDept), m_lDept); DFX_Long(pFX, _T(cRSsbWork), m_lWork); DFX_DateTime(pFX, _T(cRSsbDateHour), m_oStartTm); DFX_Long(pFX, _T(cRSsbSource), m_lSource); where cRSsbUser is the name of a access table column And finally, if I set a breakpoint in winctrl5.cpp, when i run the debug Visual C++ disable that brakpoint Now in italy is quite late, i think I'll go sleepin an hour, if i apologize if i don't reply immediately Thanks in advance, tomorrow i will try again:) -- modified at 16:34 Thursday 1st December, 2005
-
So, using m_oStartTm = COleDateTime(0); causes a compiling error(0); DoFieldExchange is: pFX->SetFieldType(CDaoFieldExchange::outputColumn); DFX_Long(pFX, _T(cRSsbUser), m_lUser); DFX_Long(pFX, _T(cRSsbCode), m_lCode); DFX_Long(pFX, _T(cRSsbDept), m_lDept); DFX_Long(pFX, _T(cRSsbWork), m_lWork); DFX_DateTime(pFX, _T(cRSsbDateHour), m_oStartTm); DFX_Long(pFX, _T(cRSsbSource), m_lSource); where cRSsbUser is the name of a access table column And finally, if I set a breakpoint in winctrl5.cpp, when i run the debug Visual C++ disable that brakpoint Now in italy is quite late, i think I'll go sleepin an hour, if i apologize if i don't reply immediately Thanks in advance, tomorrow i will try again:) -- modified at 16:34 Thursday 1st December, 2005
misturas wrote:
So, using m_oStartTm = COleDateTime(0); causes a compiling error(0);
What about this instead:
m_oStartTm = (DATE) 0;
Even if this does pacify the compiler, I feel the underlying problem still exists. I just created a test program with a class derived from
CDaoRecordset
, and an Access table having a date/time column. The constructor looked liked yours and I got no assertion. At this point, I would suggest you do the same thing, and then start adding bits and pieces of code until the problem shows up. Make sense?
"Take only what you need and leave the land as you found it." - Native American Proverb
-
misturas wrote:
So, using m_oStartTm = COleDateTime(0); causes a compiling error(0);
What about this instead:
m_oStartTm = (DATE) 0;
Even if this does pacify the compiler, I feel the underlying problem still exists. I just created a test program with a class derived from
CDaoRecordset
, and an Access table having a date/time column. The constructor looked liked yours and I got no assertion. At this point, I would suggest you do the same thing, and then start adding bits and pieces of code until the problem shows up. Make sense?
"Take only what you need and leave the land as you found it." - Native American Proverb
DavidCrow wrote:
What about this instead: m_oStartTm = (DATE) 0; Even if this does pacify the compiler, I feel the underlying problem still exists. I just created a test program with a class derived from CDaoRecordset, and an Access table having a date/time column. The constructor looked liked yours and I got no assertion. At this point, I would suggest you do the same thing, and then start adding bits and pieces of code until the problem shows up. Make sense?
I apologize if i reply only now, I had problems with internet connection I just want to ask if you have the same configuration I submit in my first msg, because if I use win 2000 I have no problem!
-
DavidCrow wrote:
What about this instead: m_oStartTm = (DATE) 0; Even if this does pacify the compiler, I feel the underlying problem still exists. I just created a test program with a class derived from CDaoRecordset, and an Access table having a date/time column. The constructor looked liked yours and I got no assertion. At this point, I would suggest you do the same thing, and then start adding bits and pieces of code until the problem shows up. Make sense?
I apologize if i reply only now, I had problems with internet connection I just want to ask if you have the same configuration I submit in my first msg, because if I use win 2000 I have no problem!
I am using Windows XP SP2.
"Take only what you need and leave the land as you found it." - Native American Proverb