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