Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all
I am using vb.net to make the salary program.
in that i had used Access Database along with DatSet created in the program.
While creating the DataSet it say that the database id outside the program folder do you want to copy in folder. In that phase i chose YES as described in many tutorial over the net.

Now the main problem is that if i insert the data in database through the program it make a copy of database inside Debug folder where the application startup path is.
that is OK.

I'm inserting the data in database inside the Debug folder where the application startup path is.

But once the program is closed and debugging is started again the database in the debug folder goes back to the previous state what it is in the main project folder.

What I have tried:

Could any one please help me as I am new to the dataset. I am not able to understand the problem.
Posted
Updated 10-May-17 22:14pm
Comments
Michael_Davies 11-May-17 4:05am    
Where is the code?

1 solution

Well yes ... it will.
What you are doing is saying "yes - copy the version in the debug folder to the main folder" each time you run it. Changes your code then makes are applied to the copy of the data you just created. When you program exits, those changes are not copied back to the debug folder but are retained in the copy in the main directory.

This is exactly what should happen: the debug folder holds a "perfect" version of the data which is copied to the "working" folder so that if your app makes huge mistakes in development, you don't lose the "base" information for next time you run it.

Instead of doing this, make a folder under the "App data" folder: open Windows Explorer and enter "%LocalAppdata%" as the address. Press ENTER and it will take you to the Local folder. Create a folder called "Test Data", and open it. Create a folder inside that called your app name. Open it. Create a folder inside that called "Good Data".
Now open a second Windows Explorer instance, and browse top your Debug folder. Copy the database file to both the folder you created, so you have a "live" and a "good" copy.
Now deleted it from your debug and main app folders, and remove the file link from your app.
Go back to the first Windows Explorer window, and click once in the address bar - that will give you the path to the "live" folder - in my case that would be:
C:\Users\PaulG\AppData\Local\Test Data\MyAppName
Copy that, and use it in the connection string you load into your app.
When you muck the DB up, just copy it from the "Good Data" folder back to the "Live" folder.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900