Resolved ms access have been deleting the data that i input?

KenQui

Member
Joined
May 11, 2022
Messages
12
Programming Experience
Beginner
Im using vb.net language and ms access in ms visual studio 2010

Why when I'm saving data or add data the ms access have been deleting the data that i input?every 2 or 1 minute it will delete after isave or add​

 
Last edited by a moderator:
Solution
As for the issue, it's almost certainly not a problem with your data being deleted but rather your database. The proper way to work with local data files is to add them to your project. By default, that data file will be copied to your output folder every time you build and it is that copy that your app connects to when it runs. In this way, you will always have a fresh database in your Release folder when it comes time to deploy your app. It also means that any modifications you make to the copy while debugging will be lost the next time you build, because the clean source database is copied over the one you made changes to.

To "fix" this issue, select the data file in the Solution Explorer, open the Properties window and change the...

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,717
Location
Sydney, Australia
Programming Experience
10+
Firstly, that's not how you ask a question. You start by writing the post and you include a FULL and CLEAR explanation of the problem. Anyone should be able to read just your post and understand everything they need to know. Once you have done that, THEN you write a summary of the problem in the title. The title is basically so that we can see whether a thread is relevant to us without opening it. You don't put most of the detail in the title and then a tiny bit extra in the post. EVERYTHING goes in the post and then a summary in the title.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,717
Location
Sydney, Australia
Programming Experience
10+
As for the issue, it's almost certainly not a problem with your data being deleted but rather your database. The proper way to work with local data files is to add them to your project. By default, that data file will be copied to your output folder every time you build and it is that copy that your app connects to when it runs. In this way, you will always have a fresh database in your Release folder when it comes time to deploy your app. It also means that any modifications you make to the copy while debugging will be lost the next time you build, because the clean source database is copied over the one you made changes to.

To "fix" this issue, select the data file in the Solution Explorer, open the Properties window and change the Copy to Output Directory property from Copy Always to Copy if Newer. That way, the source database will only be copied over the working database when you make changes to it, i.e. change the schema or modify the default data, in which case you would need a new copy anyway. Any changes you make while testing will be retained between sessions, even if you build you project again. If you ever want to refresh the database, simply change the property temporarily or delete the working database. A new copy will be created the next time you build again.
 
Solution

KenQui

Member
Joined
May 11, 2022
Messages
12
Programming Experience
Beginner
Firstly, that's not how you ask a question. You start by writing the post and you include a FULL and CLEAR explanation of the problem. Anyone should be able to read just your post and understand everything they need to know. Once you have done that, THEN you write a summary of the problem in the title. The title is basically so that we can see whether a thread is relevant to us without opening it. You don't put most of the detail in the title and then a tiny bit extra in the post. EVERYTHING goes in the post and then a summary in the title.
I'm very sorry, this is my first time here, and thank you so much I will remember that.
 

KenQui

Member
Joined
May 11, 2022
Messages
12
Programming Experience
Beginner
As for the issue, it's almost certainly not a problem with your data being deleted but rather your database. The proper way to work with local data files is to add them to your project. By default, that data file will be copied to your output folder every time you build and it is that copy that your app connects to when it runs. In this way, you will always have a fresh database in your Release folder when it comes time to deploy your app. It also means that any modifications you make to the copy while debugging will be lost the next time you build, because the clean source database is copied over the one you made changes to.

To "fix" this issue, select the data file in the Solution Explorer, open the Properties window and change the Copy to Output Directory property from Copy Always to Copy if Newer. That way, the source database will only be copied over the working database when you make changes to it, i.e. change the schema or modify the default data, in which case you would need a new copy anyway. Any changes you make while testing will be retained between sessions, even if you build you project again. If you ever want to refresh the database, simply change the property temporarily or delete the working database. A new copy will be created the next time you build again.
Thank you so much, I follow your instruction and its works.
 
Top Bottom