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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. AddNew crashing

AddNew crashing

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionannouncement
2 Posts 1 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.
  • N Offline
    N Offline
    nss
    wrote on last edited by
    #1

    I have

    	while (!m_db1.m_pRecordset->GetadoEOF ())
    	{
    
    
    		int n = m_db3.m_pRecordset->RecordCount;
    		
    		m_db3.m_pRecordset->AddNew();
    
                    SomeStuffThatAddsAValidRecordToDb3();
    
                    m_db1.m_pRecordset->MoveNext();
             }
    

    The first time through, when there were zero records in m_db3, there is no problem. Then it advances m_db1 by 1, and gets back to the top of the while. This time when it tries to execute AddNew it crashes. Incidentally, if I move the AddNew() out (just as a test), then it chokes on both UpDate(), or UpdateBatch(). What am I doing wrong? Thanks very much ns

    N 1 Reply Last reply
    0
    • N nss

      I have

      	while (!m_db1.m_pRecordset->GetadoEOF ())
      	{
      
      
      		int n = m_db3.m_pRecordset->RecordCount;
      		
      		m_db3.m_pRecordset->AddNew();
      
                      SomeStuffThatAddsAValidRecordToDb3();
      
                      m_db1.m_pRecordset->MoveNext();
               }
      

      The first time through, when there were zero records in m_db3, there is no problem. Then it advances m_db1 by 1, and gets back to the top of the while. This time when it tries to execute AddNew it crashes. Incidentally, if I move the AddNew() out (just as a test), then it chokes on both UpDate(), or UpdateBatch(). What am I doing wrong? Thanks very much ns

      N Offline
      N Offline
      nss
      wrote on last edited by
      #2

      I tracked it to:

      inline HRESULT Recordset15::AddNew ( const _variant_t & FieldList, const _variant_t & Values ) {
          HRESULT _hr = raw_AddNew(FieldList, Values);
          if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
          return _hr;
      }
      

      but the odd thing is I'm using it like AddNew() with no arguments. It compiles fine .Suggestions? If I did make a fieldlist and a values variable what are these? Arrays? thanks, ns

      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