How can I update the real database instead of the debug database?

Alice Fisher

New member
Joined
Mar 20, 2010
Messages
3
Programming Experience
3-5
Hello everyone,

I've created an application in VB.net to allow me to modify my student database, the problem being that it only updates the copy of the database in the debug folder.

How can I make the program update the real database instead?


Almost embarrassed to ask this one but I've been stumped for the past week!

Oh, I'm using Visual Studio - VB.Net - 2010

Love Alice
 
The debug database IS the real database. When you deploy your app, is the user going to be updating the database in the source folder of your project or are they going to be updating the database that's in the same folder as the deployed EXE? It's the latter, right? When you're debugging, the debug database is in the same folder as the EXE. It's the one you should be updating. The one in your source folder is the template, which should be kept clean. Otherwise you'll end up deploying a database with a load of rubbish in it, or else you'll have to clean it out every time you want to deploy. I suggest that you follow the first link in my signature to read about how local data files are, and should be, managed.
 
The debug database (in the debug folder) updates from the source database whenever I reopen the program, so all existing data is lost.

Thank you for the link though, I'll read through it now :)
 
The debug database (in the debug folder) updates from the source database whenever I reopen the program, so all existing data is lost.

Thank you for the link though, I'll read through it now :)

That's the default behaviour but you can change that. The link provided shows how.
 
The debug database (in the debug folder) updates from the source database whenever I reopen the program, so all existing data is lost.

Yes but what JMC is saying is that the database in the debug folder is the database the app is using when it runs. If you change to release, the database will be copied out to the release folder alongside the app and the app will use that instead. If you open the debug folder in explorer and run the EXE directly instead of pressing play in visual studio, the app uses the database from its same folder (but changes are not lost)

If you make an installer for you app and actually put a full, proper, live copy of the DB on your friends machine, then THAT copy of the db becomes the real one.

Note that unless you repeatedly install the program, the app you installed on your friends machine will keep its database between runs..

Please don't think that the real app on your friend's machine will overwrite its database every time it starts up; pressing PLAY in visual studio conceptually uninstalls the old app and installs a new one every time play is pressed (to use terms youre familiar with from the add/remove programs control panel)
 
Back
Top