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. Why I can't Open the mdb file correctly?

Why I can't Open the mdb file correctly?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
7 Posts 5 Posters 1 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.
  • W Offline
    W Offline
    white jungle
    wrote on last edited by
    #1

    I use CDaodatabase to open the mdb file, I use the code follow: try { m_db.Open(m_Source,FALSE,FALSE,_T("")); } catch(CDaoException* e) { e->Delete(); return false; } return true; but every time it throw a error code

    N H 2 Replies Last reply
    0
    • W white jungle

      I use CDaodatabase to open the mdb file, I use the code follow: try { m_db.Open(m_Source,FALSE,FALSE,_T("")); } catch(CDaoException* e) { e->Delete(); return false; } return true; but every time it throw a error code

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      Since you haven't posted enough code we can only guess. If you have kept the mdb open in Access , then Access has exclusive access. Close Access before running your code. That might be the problem. Nish Sonork ID 100.9786 voidmain
      www.busterboy.org
      Nish is a BIG fan of Goran Ivanisevic

      S 1 Reply Last reply
      0
      • W white jungle

        I use CDaodatabase to open the mdb file, I use the code follow: try { m_db.Open(m_Source,FALSE,FALSE,_T("")); } catch(CDaoException* e) { e->Delete(); return false; } return true; but every time it throw a error code

        H Offline
        H Offline
        Hadi Rezaee
        wrote on last edited by
        #3

        What is your Access database version ? If you used Access 2000, then you must use AfxGetModuleState for solve it ! See MSDN ! My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie

        W 1 Reply Last reply
        0
        • N Nish Nishant

          Since you haven't posted enough code we can only guess. If you have kept the mdb open in Access , then Access has exclusive access. Close Access before running your code. That might be the problem. Nish Sonork ID 100.9786 voidmain
          www.busterboy.org
          Nish is a BIG fan of Goran Ivanisevic

          S Offline
          S Offline
          Simon Walton
          wrote on last edited by
          #4

          That could be it, although, to my knowledge, Access 97 doesn't demand exclusive access to the .mbd it has open. At least, my application can read the database without any problems. Quite handy since i can modify the database in Access, and have my app redraw the results by invalidating the view. :) Simon Hey, it looks like you're writing a letter! Sonork ID 100.10024

          R 1 Reply Last reply
          0
          • H Hadi Rezaee

            What is your Access database version ? If you used Access 2000, then you must use AfxGetModuleState for solve it ! See MSDN ! My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie

            W Offline
            W Offline
            white jungle
            wrote on last edited by
            #5

            Sorry ,I can't find the AfxGetModuleState function in MSDN Can you show me how to use it? thank you

            H 1 Reply Last reply
            0
            • W white jungle

              Sorry ,I can't find the AfxGetModuleState function in MSDN Can you show me how to use it? thank you

              H Offline
              H Offline
              Hadi Rezaee
              wrote on last edited by
              #6

              One of member variables in AfxGetModuleState is about Database version, set it to 0x601 ... don't ask me WHY ? (it is because you are using Access 2000) Then you can use Open function ! Bye, i'm now busy, sorry ! My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie

              1 Reply Last reply
              0
              • S Simon Walton

                That could be it, although, to my knowledge, Access 97 doesn't demand exclusive access to the .mbd it has open. At least, my application can read the database without any problems. Quite handy since i can modify the database in Access, and have my app redraw the results by invalidating the view. :) Simon Hey, it looks like you're writing a letter! Sonork ID 100.10024

                R Offline
                R Offline
                Rassman
                wrote on last edited by
                #7

                It works better (sharing wise) if you have your tables seperate from the code/views etc. Its also handy to have your queries external. Access's own user login bit has never seemed to quite get the hang of sharing. With a sort of random selection of locking techniques, one record or whole table. This all seems to be ok once your tables are seperated. Another point, which will no doubt cause a scrap amongst us all, is that I tend towards a non Access data type. DBase IV is a favourite, since it can be made accessible from many different language/office apps and you have a wide range of ODBC drivers that your own code can use. (I'll wait behind the bike sheds for the first up) We do it for the joy of seeing the users struggle.

                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