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#
  4. Access .mdb files

Access .mdb files

Scheduled Pinned Locked Moved C#
csharptutorialquestion
7 Posts 3 Posters 14 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.
  • O Offline
    O Offline
    Omega501
    wrote on last edited by
    #1

    Is it possible to create a .mdb file with c# without Access being installed? I'm trying to make a program that will create its own dbase file if/when the dbase gets deleted accidently or by clicking a button. If it'a possible, any example code or places I should be looking for more info?

    R S 2 Replies Last reply
    0
    • O Omega501

      Is it possible to create a .mdb file with c# without Access being installed? I'm trying to make a program that will create its own dbase file if/when the dbase gets deleted accidently or by clicking a button. If it'a possible, any example code or places I should be looking for more info?

      R Offline
      R Offline
      Rob Graham
      wrote on last edited by
      #2

      You would have to use interop and the Microsoft ActiveX Data Objects Extensions for Data Definition Language and Security (ADOX) To do this, since MS Access sql syntax does not support "create database". IMO a better alternative is to just include a small empty database as a template, and use filecopy to create the starting database (faster, too...). If your schema is constant, you can even pre-build all empty tables and queries, saving a good deal of 'one time' code in your application. :) Some ideas are so stupid that only an intellectual could have thought of them - George Orwell

      O 1 Reply Last reply
      0
      • O Omega501

        Is it possible to create a .mdb file with c# without Access being installed? I'm trying to make a program that will create its own dbase file if/when the dbase gets deleted accidently or by clicking a button. If it'a possible, any example code or places I should be looking for more info?

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

        Let me point you to "Programming OLEDB with C#" - http://www.manning.com/dotnetbooks/csharpprimer/sql\_to\_access.html

        R 1 Reply Last reply
        0
        • S spacemonkey

          Let me point you to "Programming OLEDB with C#" - http://www.manning.com/dotnetbooks/csharpprimer/sql\_to\_access.html

          R Offline
          R Offline
          Rob Graham
          wrote on last edited by
          #4

          like I said - one must use ADOX to create an access database programatically. :) Some ideas are so stupid that only an intellectual could have thought of them - George Orwell

          1 Reply Last reply
          0
          • R Rob Graham

            You would have to use interop and the Microsoft ActiveX Data Objects Extensions for Data Definition Language and Security (ADOX) To do this, since MS Access sql syntax does not support "create database". IMO a better alternative is to just include a small empty database as a template, and use filecopy to create the starting database (faster, too...). If your schema is constant, you can even pre-build all empty tables and queries, saving a good deal of 'one time' code in your application. :) Some ideas are so stupid that only an intellectual could have thought of them - George Orwell

            O Offline
            O Offline
            Omega501
            wrote on last edited by
            #5

            Yes, after reading the other replies I think that is much easier :) . Would it be possible to include this templated .mdb file as a resource in the app? Basically what I'm after is a single .exe file as the final result as this app would be copied rather than installed, and with the technical level of my clients, a single file is the easiest option.

            R 1 Reply Last reply
            0
            • O Omega501

              Yes, after reading the other replies I think that is much easier :) . Would it be possible to include this templated .mdb file as a resource in the app? Basically what I'm after is a single .exe file as the final result as this app would be copied rather than installed, and with the technical level of my clients, a single file is the easiest option.

              R Offline
              R Offline
              Rob Graham
              wrote on last edited by
              #6

              I haven't tried that, but it should work. Just create a new empty file and then copy the resource bytes to it with a BinaryWriter..bytes is bytes :) Some ideas are so stupid that only an intellectual could have thought of them - George Orwell

              O 1 Reply Last reply
              0
              • R Rob Graham

                I haven't tried that, but it should work. Just create a new empty file and then copy the resource bytes to it with a BinaryWriter..bytes is bytes :) Some ideas are so stupid that only an intellectual could have thought of them - George Orwell

                O Offline
                O Offline
                Omega501
                wrote on last edited by
                #7

                Thanks, I'll give that a go

                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