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. Database operation in VC++

Database operation in VC++

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasehelporaclequestion
5 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.
  • M Offline
    M Offline
    maharaja pandian
    wrote on last edited by
    #1

    hi, i want to develop one application in VC++ MFC ,which can insert & retrive data from a database(oracle), through a dll .The Dll is resposible for handling all database operation. can any please help to work on that... "EXE" + "DLL" + "DB" 1.how can i make a connection string for oracle database which is in remote system. 2.how can i handle DB opeartion in Dll. i try with Dll , but it through error send reply ,,,early :) Try again and again, At last you will say I don't know the meaning for impossible.,. -- modified at 11:37 Wednesday 7th June, 2006

    D 1 Reply Last reply
    0
    • M maharaja pandian

      hi, i want to develop one application in VC++ MFC ,which can insert & retrive data from a database(oracle), through a dll .The Dll is resposible for handling all database operation. can any please help to work on that... "EXE" + "DLL" + "DB" 1.how can i make a connection string for oracle database which is in remote system. 2.how can i handle DB opeartion in Dll. i try with Dll , but it through error send reply ,,,early :) Try again and again, At last you will say I don't know the meaning for impossible.,. -- modified at 11:37 Wednesday 7th June, 2006

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

      maharaja pandian wrote:

      i try with Dll , but it through error

      And that error would be what?


      "The largest fire starts but with the smallest spark." - David Crow

      "Judge not by the eye but by the heart." - Native American Proverb

      PJ ArendsP M 2 Replies Last reply
      0
      • D David Crow

        maharaja pandian wrote:

        i try with Dll , but it through error

        And that error would be what?


        "The largest fire starts but with the smallest spark." - David Crow

        "Judge not by the eye but by the heart." - Native American Proverb

        PJ ArendsP Offline
        PJ ArendsP Offline
        PJ Arends
        wrote on last edited by
        #3

        DavidCrow wrote:

        And that error would be what?

        You sure are nosey, aren't you:doh:


        You may be right
        I may be crazy
        -- Billy Joel --

        Within you lies the power for good, use it!!!

        Within you lies the power for good; Use it!

        1 Reply Last reply
        0
        • D David Crow

          maharaja pandian wrote:

          i try with Dll , but it through error

          And that error would be what?


          "The largest fire starts but with the smallest spark." - David Crow

          "Judge not by the eye but by the heart." - Native American Proverb

          M Offline
          M Offline
          maharaja pandian
          wrote on last edited by
          #4

          in the Dll file when i try to open DB using the below function it work but when i try to open the recordset open i.e.,rsOpen() , it open a DataSource dialog screen will opened ,instead of executing a sql query ////////////////////////////////////////////////////////////////////////// bool CDaoDB::dbOpen(CString strFilePathName) { try { db = new CDaoDatabase(NULL); db->Open(strFilePathName); return true; } catch(CDaoException* error) { delete db; db = NULL; LPTSTR errors = ""; error->GetErrorMessage(errors,100,NULL); AfxMessageBox(errors); return false; } } bool CDaoRS::rsOpen(CString sql,CDaoDatabase* db) { CDaoTableDef *df; try { if(db) { rs = new CDaoRecordset(db); rs->Open(dbOpenDynaset,sql); return true; } else { AfxMessageBox("There is no current database open."); return false; } } catch(CDaoException* error) { delete rs; rs = NULL; LPTSTR errors = ""; error->GetErrorMessage(errors,100,NULL); AfxMessageBox(errors); return false; } } Try again and again, At last you will say I don't know the meaning for impossible.,.

          D 1 Reply Last reply
          0
          • M maharaja pandian

            in the Dll file when i try to open DB using the below function it work but when i try to open the recordset open i.e.,rsOpen() , it open a DataSource dialog screen will opened ,instead of executing a sql query ////////////////////////////////////////////////////////////////////////// bool CDaoDB::dbOpen(CString strFilePathName) { try { db = new CDaoDatabase(NULL); db->Open(strFilePathName); return true; } catch(CDaoException* error) { delete db; db = NULL; LPTSTR errors = ""; error->GetErrorMessage(errors,100,NULL); AfxMessageBox(errors); return false; } } bool CDaoRS::rsOpen(CString sql,CDaoDatabase* db) { CDaoTableDef *df; try { if(db) { rs = new CDaoRecordset(db); rs->Open(dbOpenDynaset,sql); return true; } else { AfxMessageBox("There is no current database open."); return false; } } catch(CDaoException* error) { delete rs; rs = NULL; LPTSTR errors = ""; error->GetErrorMessage(errors,100,NULL); AfxMessageBox(errors); return false; } } Try again and again, At last you will say I don't know the meaning for impossible.,.

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

            maharaja pandian wrote:

            LPTSTR errors = ""; error->GetErrorMessage(errors,100,NULL);

            This will likely fail as no memory has been made available for GetErrorMessage() to write the error message to.

            maharaja pandian wrote:

            rs->Open(dbOpenDynaset,sql);

            What is the value of sql? Have you stepped into this method to see what is prompting the Open dialog to be displayed?


            "The largest fire starts but with the smallest spark." - David Crow

            "Judge not by the eye but by the heart." - Native American Proverb

            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