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. (ADO v2.20) pRs->Delete(); Crashes the application

(ADO v2.20) pRs->Delete(); Crashes the application

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionannouncement
7 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.
  • S Offline
    S Offline
    sdancer75
    wrote on last edited by
    #1

    Using the class "A set of ADO classes - version 2.20 By Carlos Antollini" Trying to delete the current record set with the following code if (pRs->IsOpen()) { if (!pRs->IsEOF()) pRs->Delete(); } the application craches with "unhandled exception in App.exe (kernel32.dll) 0xe06d7363:Microsodt C++ Exception. What seems to be worng ? sdancer

    K S 3 Replies Last reply
    0
    • S sdancer75

      Using the class "A set of ADO classes - version 2.20 By Carlos Antollini" Trying to delete the current record set with the following code if (pRs->IsOpen()) { if (!pRs->IsEOF()) pRs->Delete(); } the application craches with "unhandled exception in App.exe (kernel32.dll) 0xe06d7363:Microsodt C++ Exception. What seems to be worng ? sdancer

      K Offline
      K Offline
      kdehairy
      wrote on last edited by
      #2

      first put your code inside a try catch block: try { //your ADO code } catch(_com_error &err) { AfxMessageBox(err.Description()); } this will issue a message box with the error description returned by the ADO.Recordset object no body can help you with this error with the information you supplied here!! k_dehairy

      S 1 Reply Last reply
      0
      • K kdehairy

        first put your code inside a try catch block: try { //your ADO code } catch(_com_error &err) { AfxMessageBox(err.Description()); } this will issue a message box with the error description returned by the ADO.Recordset object no body can help you with this error with the information you supplied here!! k_dehairy

        S Offline
        S Offline
        sdancer75
        wrote on last edited by
        #3

        thank you, what more informations do you want to supply ? Regards, George sdancer

        1 Reply Last reply
        0
        • S sdancer75

          Using the class "A set of ADO classes - version 2.20 By Carlos Antollini" Trying to delete the current record set with the following code if (pRs->IsOpen()) { if (!pRs->IsEOF()) pRs->Delete(); } the application craches with "unhandled exception in App.exe (kernel32.dll) 0xe06d7363:Microsodt C++ Exception. What seems to be worng ? sdancer

          S Offline
          S Offline
          sdancer75
          wrote on last edited by
          #4

          The commands before Rs->IsOpen() is a Select query statement with outter Left join to other tables, and it works fine when i try to show them. It is just used in a ShowRecord Dialog with a Delete Button to delete the current record that is shown currently in the window objects. The MoveNext() & MovePrevious() buttons works just fine. Regards, George sdancer

          K 1 Reply Last reply
          0
          • S sdancer75

            The commands before Rs->IsOpen() is a Select query statement with outter Left join to other tables, and it works fine when i try to show them. It is just used in a ShowRecord Dialog with a Delete Button to delete the current record that is shown currently in the window objects. The MoveNext() & MovePrevious() buttons works just fine. Regards, George sdancer

            K Offline
            K Offline
            kdehairy
            wrote on last edited by
            #5

            you still need to put your ADO code in a try .. catch blocks, just like what I pointed earlier. then tell me what did the messagebox say. generally speeking any code that deals with COM objects (like ADO) is better written inside try .. catch blocks. k_dehairy

            S 1 Reply Last reply
            0
            • K kdehairy

              you still need to put your ADO code in a try .. catch blocks, just like what I pointed earlier. then tell me what did the messagebox say. generally speeking any code that deals with COM objects (like ADO) is better written inside try .. catch blocks. k_dehairy

              S Offline
              S Offline
              sdancer75
              wrote on last edited by
              #6

              Trying the code you said, i receive the following error. if (!pRs->IsEOF()) { try { pRs->Delete(); } catch(_com_error &err) { AfxMessageBox(err.Description()); return; } } (I will make an english translation of the error code since i get it in Greeks) "It was not possible to find the row for update.Its possible that some values have changed since the last read." What Seems to be the problem ? Below is the OnInitDialog() code and you can see the select query. BOOL CBookProperties::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString strSQL,strVal; wchar_t buffer[20]; m_Sheet.AddPage (&m_SheetBasic); m_Sheet.AddPage (&m_SheetDetails); m_Sheet.AddPage (&m_SheetExtras); m_Sheet.AddPage (&m_SheetPhoto); m_Sheet.Create (this, WS_TABSTOP | WS_CHILD | WS_VISIBLE,WS_EX_CONTROLPARENT); m_Sheet.SetWindowPos (NULL,0,100, 0,0,SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); //NEW Record if (m_mode == NEW) { m_bNext.EnableWindow (FALSE); m_bPrevious.EnableWindow (FALSE); m_bPrint.EnableWindow (FALSE); m_bDelete.EnableWindow (FALSE); } else //EDIT VIEW Record { pAdoDb = new CADODatabase(); try { if (pAdoDb->Open(((CLibrarianApp*)AfxGetApp())->m_strConnection)) { pRs = new CADORecordset(pAdoDb); _ultow( m_lRecSQLCode, buffer, 10 ); //find the specific record strSQL=_T("SELECT Books.*, Categories.CategoryDesc, Author1,PublishHouses.PublishHouseDesc ") _T("FROM books LEFT OUTER JOIN Categories ") _T("On Books.CategoryID=Categories.CategoryID LEFT OUTER JOIN PublishHouses ") _T("On Books.CategoryID=PublishHouses.PublishHouseID ") _T("WHERE BookID=") + CString(buffer) + " " _T("ORDER BY title,author1,categoryDesc ASC"); if (pRs->Open(strSQL,CADORecordset::openQuery) ) { SetRecordValues(); UpdateData(FALSE); m_lAbsRecPosition=pRs->GetAbsolutePosition(); pRs->Close(); } else { pRs->Close(); delete pRs; } //now set a global query to use with next & previous button strSQL=_T("SELECT Books.*, Categories.CategoryDesc, Author1,PublishHouses.PublishHouseDesc ") _T("FROM books LEFT OUTER JOIN Categories ") _T("On Books.CategoryID=Categories.CategoryID LEFT OUTER JOIN PublishHouses ") _T("On Books.CategoryID=PublishHouses.PublishHouseID ")

              1 Reply Last reply
              0
              • S sdancer75

                Using the class "A set of ADO classes - version 2.20 By Carlos Antollini" Trying to delete the current record set with the following code if (pRs->IsOpen()) { if (!pRs->IsEOF()) pRs->Delete(); } the application craches with "unhandled exception in App.exe (kernel32.dll) 0xe06d7363:Microsodt C++ Exception. What seems to be worng ? sdancer

                S Offline
                S Offline
                sdancer75
                wrote on last edited by
                #7

                I found the error, It was the Outter Join from the query ! Regards, sdancer75

                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