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. .NET (Core and Framework)
  4. Compiling erases DATA in Access DATABASE ?

Compiling erases DATA in Access DATABASE ?

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpdatabasequestion
7 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.
  • J Offline
    J Offline
    Johnkokk
    wrote on last edited by
    #1

    Ok here is the issue. I make an application, that the user can store various data in a MS ACCESS DATABASE. I make all the connections, etc. and everything works ok. So i test run my application.I insert data to the database through my program.Everything works ok. I want to fix a bug.I correct the program and re run the app. The database is empty now and i have to re-enter the data. Even the slightest change in the program code, deletes the data from the database. Is this normal ? Thanks

    L H 2 Replies Last reply
    0
    • J Johnkokk

      Ok here is the issue. I make an application, that the user can store various data in a MS ACCESS DATABASE. I make all the connections, etc. and everything works ok. So i test run my application.I insert data to the database through my program.Everything works ok. I want to fix a bug.I correct the program and re run the app. The database is empty now and i have to re-enter the data. Even the slightest change in the program code, deletes the data from the database. Is this normal ? Thanks

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Johnkokk wrote:

      Is this normal ?

      No, unless you included code to that effect. :confused:

      Luc Pattyn


      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


      J 1 Reply Last reply
      0
      • L Luc Pattyn

        Johnkokk wrote:

        Is this normal ?

        No, unless you included code to that effect. :confused:

        Luc Pattyn


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        J Offline
        J Offline
        Johnkokk
        wrote on last edited by
        #3

        Note that when i test run my app, i do it through the IDE. Here are the steps, so that you can understand better. 1.Write some VB. net code. 2.Run through IDE 3.Insert data to database through my app 4.Find a bug 5.Stop the execution 6.Correct the bug 7.Re run the app through the IDE Data that i inserted on step 3, are deleted and Database is empty. If i open the database with MS ACCESS, fill some data there and run it from my app, everything is OK.

        1 Reply Last reply
        0
        • J Johnkokk

          Ok here is the issue. I make an application, that the user can store various data in a MS ACCESS DATABASE. I make all the connections, etc. and everything works ok. So i test run my application.I insert data to the database through my program.Everything works ok. I want to fix a bug.I correct the program and re run the app. The database is empty now and i have to re-enter the data. Even the slightest change in the program code, deletes the data from the database. Is this normal ? Thanks

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #4

          In Solution Explorer Window click your database file node (the one with the little golden cylinder icon) then hit F4. Is 'Copy To Output Directory' set to 'Copy Always' (I think this is the default). If so, change it to 'Copy if Newer' or 'Never' once you understand what they mean. I have been caught by this when I first started. What happens by default is that each time you run the app VS copies your empty database to your output directory, overwriting your nice data filled one. 'Copy if Newer' only does so if you change the DB in some way, so you need to take steps to protect the data you have entered.

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          L J 2 Replies Last reply
          0
          • H Henry Minute

            In Solution Explorer Window click your database file node (the one with the little golden cylinder icon) then hit F4. Is 'Copy To Output Directory' set to 'Copy Always' (I think this is the default). If so, change it to 'Copy if Newer' or 'Never' once you understand what they mean. I have been caught by this when I first started. What happens by default is that each time you run the app VS copies your empty database to your output directory, overwriting your nice data filled one. 'Copy if Newer' only does so if you change the DB in some way, so you need to take steps to protect the data you have entered.

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            That makes perfect sense. Putting data files in a Visual Studio folder is something I like to avoid. :)

            Luc Pattyn


            I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


            H 1 Reply Last reply
            0
            • L Luc Pattyn

              That makes perfect sense. Putting data files in a Visual Studio folder is something I like to avoid. :)

              Luc Pattyn


              I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #6

              Yep. Unfortunately, a couple of the MSDN HOWTO:s/WALKTHROUGH:s tell you to do it that way. Project|Add Item|Database......... It usually mentions (or links to a page that does) the 'Copy Always' problem but it is well hidden.

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              1 Reply Last reply
              0
              • H Henry Minute

                In Solution Explorer Window click your database file node (the one with the little golden cylinder icon) then hit F4. Is 'Copy To Output Directory' set to 'Copy Always' (I think this is the default). If so, change it to 'Copy if Newer' or 'Never' once you understand what they mean. I have been caught by this when I first started. What happens by default is that each time you run the app VS copies your empty database to your output directory, overwriting your nice data filled one. 'Copy if Newer' only does so if you change the DB in some way, so you need to take steps to protect the data you have entered.

                Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                J Offline
                J Offline
                Johnkokk
                wrote on last edited by
                #7

                Yeap, that was it.The "Copy always" thing. I knew it was not "normal". Thanks people.

                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