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

debug error

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasedebugginghelp
6 Posts 3 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.
  • R Offline
    R Offline
    ranjjj
    wrote on last edited by
    #1

    ERROR IN THIS PART OF A MFC APPLICATION! IT SAYS.. DAMAGE:AFTER NORMAL BLOCK #90 AT 0*30101110 This prog is basically to get a particular record from a databaseprinted in the edit box. void CProd_listDlg::OnOK() { UpdateData(TRUE); // TODO: Add extra validation here ADODB::_ConnectionPtr m_pConnection = NULL; ADODB::_RecordsetPtr pRecordset = NULL; VARIANT *vRecordsAffected = NULL; char ConStr[500]; char ConStr1[100]; _bstr_t prodname; _bstr_t id; BOOL m_bIsConnectionOpen; char strSelect[500]; // Create an instance of _Connection HRESULT hr ; hr = m_pConnection.CreateInstance(__uuidof(ADODB::Connection)); if (SUCCEEDED(hr)) { //Open a connection where database is access database : "c:\\emailparsing\\prod_list.mdb" ConStr[0] = '\0'; strcat(ConStr, "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="); strcat(ConStr, "c:\\Aegis_proj\\prod_list.mdb" ); m_pConnection->Open(ConStr, "", "", 0); //If database opened successfully then set IsConnectionOpen to TRUE if (SUCCEEDED(hr)) { m_bIsConnectionOpen = TRUE; } } try { ::MessageBox(NULL, m_edit1, "", MB_OK); _bstr_t ConStr(m_edit1); ::MessageBox(NULL,ConStr,"",MB_OK); // strProductName = m_edit1; sprintf(strSelect,"SELECT * FROM prodlist WHERE product_name = '%s' ", (char *)ConStr); ::MessageBox(NULL,strSelect,"",MB_OK); _bstr_t ConStr1(strSelect); ::MessageBox(NULL,ConStr1,"",MB_OK); pRecordset = m_pConnection->Execute(ConStr1, vRecordsAffected, 1); ::MessageBox(NULL, "returning", "", MB_OK); if (!pRecordset->GetEOFile()) { int i = 0; id = ((_bstr_t) pRecordset->GetFields()->GetItem("id")->GetValue()); prodname = ((_bstr_t) pRecordset->GetFields()->GetItem("product_name")->GetValue()); strcat(id,prodname); ::MessageBox(NULL, id, "", MB_OK); m_edit2 = LPCTSTR(id); ::MessageBox(NULL, m_edit2, "", MB_OK); UpdateData(FALSE); i++; } pRecordset->Close(); } catch (_com_error &e) { ::MessageBox(NULL, (LPCTSTR)e.Description(), "Error!", MB_OK); //printf("Description = '%s'\n", (char*) e.Description()); } CDialog::OnOK(); return ; } void CProd_listDlg::OnCancel() { // TODO: Add extra cleanup here CDialog::OnCancel(); } void CProd_listDlg::OnChangeEdit1() { // TODO: If this is a RICHEDIT control, the control w

    M D 2 Replies Last reply
    0
    • R ranjjj

      ERROR IN THIS PART OF A MFC APPLICATION! IT SAYS.. DAMAGE:AFTER NORMAL BLOCK #90 AT 0*30101110 This prog is basically to get a particular record from a databaseprinted in the edit box. void CProd_listDlg::OnOK() { UpdateData(TRUE); // TODO: Add extra validation here ADODB::_ConnectionPtr m_pConnection = NULL; ADODB::_RecordsetPtr pRecordset = NULL; VARIANT *vRecordsAffected = NULL; char ConStr[500]; char ConStr1[100]; _bstr_t prodname; _bstr_t id; BOOL m_bIsConnectionOpen; char strSelect[500]; // Create an instance of _Connection HRESULT hr ; hr = m_pConnection.CreateInstance(__uuidof(ADODB::Connection)); if (SUCCEEDED(hr)) { //Open a connection where database is access database : "c:\\emailparsing\\prod_list.mdb" ConStr[0] = '\0'; strcat(ConStr, "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="); strcat(ConStr, "c:\\Aegis_proj\\prod_list.mdb" ); m_pConnection->Open(ConStr, "", "", 0); //If database opened successfully then set IsConnectionOpen to TRUE if (SUCCEEDED(hr)) { m_bIsConnectionOpen = TRUE; } } try { ::MessageBox(NULL, m_edit1, "", MB_OK); _bstr_t ConStr(m_edit1); ::MessageBox(NULL,ConStr,"",MB_OK); // strProductName = m_edit1; sprintf(strSelect,"SELECT * FROM prodlist WHERE product_name = '%s' ", (char *)ConStr); ::MessageBox(NULL,strSelect,"",MB_OK); _bstr_t ConStr1(strSelect); ::MessageBox(NULL,ConStr1,"",MB_OK); pRecordset = m_pConnection->Execute(ConStr1, vRecordsAffected, 1); ::MessageBox(NULL, "returning", "", MB_OK); if (!pRecordset->GetEOFile()) { int i = 0; id = ((_bstr_t) pRecordset->GetFields()->GetItem("id")->GetValue()); prodname = ((_bstr_t) pRecordset->GetFields()->GetItem("product_name")->GetValue()); strcat(id,prodname); ::MessageBox(NULL, id, "", MB_OK); m_edit2 = LPCTSTR(id); ::MessageBox(NULL, m_edit2, "", MB_OK); UpdateData(FALSE); i++; } pRecordset->Close(); } catch (_com_error &e) { ::MessageBox(NULL, (LPCTSTR)e.Description(), "Error!", MB_OK); //printf("Description = '%s'\n", (char*) e.Description()); } CDialog::OnOK(); return ; } void CProd_listDlg::OnCancel() { // TODO: Add extra cleanup here CDialog::OnCancel(); } void CProd_listDlg::OnChangeEdit1() { // TODO: If this is a RICHEDIT control, the control w

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      Just a couple of things at first glance, char ConStr[500]; _bstr_t ConStr(m_edit1); Using the same name for two different variables is confusing. Also, shouldn't you have a MoveFirst() before you attempt to get values from your recordset. I'm not sure but shouldn't VARIANT *vRecordsAffected = NULL; be VARIANT vRecordsAffected; Michael 'Logic, my dear Zoe, merely enables one to be wrong with authority.' - The Doctor: The Wheel in Space

      R 1 Reply Last reply
      0
      • M Michael P Butler

        Just a couple of things at first glance, char ConStr[500]; _bstr_t ConStr(m_edit1); Using the same name for two different variables is confusing. Also, shouldn't you have a MoveFirst() before you attempt to get values from your recordset. I'm not sure but shouldn't VARIANT *vRecordsAffected = NULL; be VARIANT vRecordsAffected; Michael 'Logic, my dear Zoe, merely enables one to be wrong with authority.' - The Doctor: The Wheel in Space

        R Offline
        R Offline
        ranjjj
        wrote on last edited by
        #3

        it didn't workk i get debug error! on debugging i noticed that the program control doesn't go after the return statement int the end! ranjani

        1 Reply Last reply
        0
        • R ranjjj

          ERROR IN THIS PART OF A MFC APPLICATION! IT SAYS.. DAMAGE:AFTER NORMAL BLOCK #90 AT 0*30101110 This prog is basically to get a particular record from a databaseprinted in the edit box. void CProd_listDlg::OnOK() { UpdateData(TRUE); // TODO: Add extra validation here ADODB::_ConnectionPtr m_pConnection = NULL; ADODB::_RecordsetPtr pRecordset = NULL; VARIANT *vRecordsAffected = NULL; char ConStr[500]; char ConStr1[100]; _bstr_t prodname; _bstr_t id; BOOL m_bIsConnectionOpen; char strSelect[500]; // Create an instance of _Connection HRESULT hr ; hr = m_pConnection.CreateInstance(__uuidof(ADODB::Connection)); if (SUCCEEDED(hr)) { //Open a connection where database is access database : "c:\\emailparsing\\prod_list.mdb" ConStr[0] = '\0'; strcat(ConStr, "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="); strcat(ConStr, "c:\\Aegis_proj\\prod_list.mdb" ); m_pConnection->Open(ConStr, "", "", 0); //If database opened successfully then set IsConnectionOpen to TRUE if (SUCCEEDED(hr)) { m_bIsConnectionOpen = TRUE; } } try { ::MessageBox(NULL, m_edit1, "", MB_OK); _bstr_t ConStr(m_edit1); ::MessageBox(NULL,ConStr,"",MB_OK); // strProductName = m_edit1; sprintf(strSelect,"SELECT * FROM prodlist WHERE product_name = '%s' ", (char *)ConStr); ::MessageBox(NULL,strSelect,"",MB_OK); _bstr_t ConStr1(strSelect); ::MessageBox(NULL,ConStr1,"",MB_OK); pRecordset = m_pConnection->Execute(ConStr1, vRecordsAffected, 1); ::MessageBox(NULL, "returning", "", MB_OK); if (!pRecordset->GetEOFile()) { int i = 0; id = ((_bstr_t) pRecordset->GetFields()->GetItem("id")->GetValue()); prodname = ((_bstr_t) pRecordset->GetFields()->GetItem("product_name")->GetValue()); strcat(id,prodname); ::MessageBox(NULL, id, "", MB_OK); m_edit2 = LPCTSTR(id); ::MessageBox(NULL, m_edit2, "", MB_OK); UpdateData(FALSE); i++; } pRecordset->Close(); } catch (_com_error &e) { ::MessageBox(NULL, (LPCTSTR)e.Description(), "Error!", MB_OK); //printf("Description = '%s'\n", (char*) e.Description()); } CDialog::OnOK(); return ; } void CProd_listDlg::OnCancel() { // TODO: Add extra cleanup here CDialog::OnCancel(); } void CProd_listDlg::OnChangeEdit1() { // TODO: If this is a RICHEDIT control, the control w

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

          To get any useful replies, you might consider narrowing it down quite a bit (i.e., looking at a whole wad of irrelevant code will scare off even the most seasoned troubleshooter). What sort of error is it? Is an assertion firing? Have you single-stepped through the code with the debugger? Provide some hints as to what is happening versus what is supposed to happen.


          Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

          R 1 Reply Last reply
          0
          • D David Crow

            To get any useful replies, you might consider narrowing it down quite a bit (i.e., looking at a whole wad of irrelevant code will scare off even the most seasoned troubleshooter). What sort of error is it? Is an assertion firing? Have you single-stepped through the code with the debugger? Provide some hints as to what is happening versus what is supposed to happen.


            Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

            R Offline
            R Offline
            ranjjj
            wrote on last edited by
            #5

            what is supposed to happen is.. as i enter the product name..and on clicking ok.. the prog should look for the record with that particular product name and fetch that particular record..in the specified location.. then...get the record and display it in the edit box in the dialogue box.. and shud exit! what is haeppening is..this is giving an error!after diplaying in the edit box! ranjani

            D 1 Reply Last reply
            0
            • R ranjjj

              what is supposed to happen is.. as i enter the product name..and on clicking ok.. the prog should look for the record with that particular product name and fetch that particular record..in the specified location.. then...get the record and display it in the edit box in the dialogue box.. and shud exit! what is haeppening is..this is giving an error!after diplaying in the edit box! ranjani

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

              ranjjj wrote: this is giving an error!after diplaying in the edit box! And that error would be ??


              Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

              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