Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with COleDateTime obj

Problem with COleDateTime obj

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpdebuggingquestionannouncement
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    misturas
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • M misturas

      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

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • D David Crow

        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

        M Offline
        M Offline
        misturas
        wrote on last edited by
        #3

        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...

        D 1 Reply Last reply
        0
        • M misturas

          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...

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          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 from COleDateTime::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

          M 1 Reply Last reply
          0
          • D David Crow

            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 from COleDateTime::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

            M Offline
            M Offline
            misturas
            wrote on last edited by
            #5

            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

            D 1 Reply Last reply
            0
            • M misturas

              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

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              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

              M 1 Reply Last reply
              0
              • D David Crow

                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

                M Offline
                M Offline
                misturas
                wrote on last edited by
                #7

                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!

                D 1 Reply Last reply
                0
                • M misturas

                  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!

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  I am using Windows XP SP2.


                  "Take only what you need and leave the land as you found it." - Native American Proverb

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups