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. Debug Assertion Failed!

Debug Assertion Failed!

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasedebuggingquestion
4 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.
  • I Offline
    I Offline
    ivex
    wrote on last edited by
    #1

    Code: #include "dao.h" void main() { COleVariant m_var; LPCSTR m_str; try { CDaoDatabase *base = new CDaoDatabase; base->Open("c:\\biblio.mdb"); CDaoRecordset *rst = new CDaoRecordset(base); rst->Open(dbOpenDynaset, "select * from authors"); for(int i=0; i<3; i++) { m_var = rst->GetFieldValue("Author"); m_str = (LPCSTR) m_var.bstrVal; printf("%d, %s\n", i+1, m_str); rst->MoveNext(); } rst->Close(); base->Close(); } catch(CDaoException e) { } } the header file includes stdio.h and afxdao.h. Everthing is ok but after print out the first three records in the database, a dialog box appeared with the following message: Debug Assertion Failed! Program: C:\WINDOWS\DESKTOP\DATABASE\0041\DEBUG\DAO.EXE File: daocore.cpp Line: 39 What's wrong?:confused:

    T 1 Reply Last reply
    0
    • I ivex

      Code: #include "dao.h" void main() { COleVariant m_var; LPCSTR m_str; try { CDaoDatabase *base = new CDaoDatabase; base->Open("c:\\biblio.mdb"); CDaoRecordset *rst = new CDaoRecordset(base); rst->Open(dbOpenDynaset, "select * from authors"); for(int i=0; i<3; i++) { m_var = rst->GetFieldValue("Author"); m_str = (LPCSTR) m_var.bstrVal; printf("%d, %s\n", i+1, m_str); rst->MoveNext(); } rst->Close(); base->Close(); } catch(CDaoException e) { } } the header file includes stdio.h and afxdao.h. Everthing is ok but after print out the first three records in the database, a dialog box appeared with the following message: Debug Assertion Failed! Program: C:\WINDOWS\DESKTOP\DATABASE\0041\DEBUG\DAO.EXE File: daocore.cpp Line: 39 What's wrong?:confused:

      T Offline
      T Offline
      Tim Smith
      wrote on last edited by
      #2

      What does line 39 in daocore.cpp look like? Usually from that you can tell what the problem is. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

      I 1 Reply Last reply
      0
      • T Tim Smith

        What does line 39 in daocore.cpp look like? Usually from that you can tell what the problem is. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

        I Offline
        I Offline
        ivex
        wrote on last edited by
        #3

        I couldn't find the file 'daocore.cpp', somebody knows what or where it is?

        T 1 Reply Last reply
        0
        • I ivex

          I couldn't find the file 'daocore.cpp', somebody knows what or where it is?

          T Offline
          T Offline
          Tim Smith
          wrote on last edited by
          #4

          MFC source Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

          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