Copy/Replace/Open MS Access DataBase in VB as a User - vb.net

So basically I made a FamilyTree Program using MS Access DataBase. I want the user to be able to 'Export'(Copy) the Access File and be able to 'Import'(Replace) it in the program after it's already built. I tried looking for this but all I get is how to do these things as a programmer and not a user.
If anyone could point me in the right direction, I'd be grateful :)

Just close the connection to the file and do a simple file copy.
To restore, copy the backup file overwriting the current file.

Related

Creating a working copy of an old Access 2010 database

I am tasked with fixing some bugs that an access 2010 database, written 10 or so years ago, has. The database has been functioning but has a few bugs in report generation that need to be fixed (ie: bugs are not impeding overall functionality).
Since I am relatively new to access 2010, I wanted to create a working copy of the entire database, VBA and all, so that I could get into the VBA code and figure out what is causing the bugs without accidentally sending some of the automatic emails or changing pertinent information in the data. I have tried saving the database with a new name, copying it in the folder and pasting elsewhere, and creating a backup and saving that elsewhere.
Each attempt yields the same issue: the VBA project not being readable. It gives the following message when I open any copy:
if included picture doesn't load: tl/dr: database cant be opened because VBA project cant be read, if "ok" is clicked vba project will be deleted..I have searched high and low, asked everyone that has used the database, nobody knows how to fix the issue and I do not feel comfortable changing anything in the live copy.
Any assistance would be greatly appreciated. Thank you in advance.
One option you might try is to create a new blank database file and attempt to import all of the database objects from a copy of your target database into the new database file using the import wizard. If that's successful it won't be an exact replica of the previous database with regards to settings, but will include all of the database objects/code at least.

Create a copy of a file with Visual Studio 2012

I am sorry for the bad heading, but no better came to my mind.
I am creating a program (vb.net) with a database. When I build the program the database is already in and the program is working.
If the user of the build, uses and edits the database, the changes are saved. But if I update the program the database will be overwritten and all the changes of the user are gone.
I'm searching for a solution since hours, but I can't find good keywords for searching. So maybe someone can help me.
My idea is to copy the database from the program, which is saved here:
C:\Users\<Username>\AppData\Local\Apps\2.0\XB8ZOKH5.AK0\C9NZMRPR.25M
to a permanent storage place, e.g. here:
C:\Users\<Username>\program\database.accdb
How can I do this with Visual studio?
You are on the right track. I learned a similar technique, years ago and it has worked well for small projects like yours.
Your installer should only install a "template" version of your database on the hard drive.
When your program starts up, it can try to connect to the "working copy" of the database. If the user cannot connect to the database, or there is no setting for the "working copy", the program can make a copy of the "template" (System.IO.File.Copy) and save a setting, pointing to the "working copy". Then each time the program is upgraded, your full database will be safe. Of course, it is also a good idea to have your program make a "backup" of the database (zip) often.

VB.net connection to embedded database

I have a stand-alone Windows Form app written in VB.NET that currently connects to a local Access DB (.mdb file) and consumes data from several of the tables. It never writes to nor modifies the DB. I'm trying to figure out how to secure this DB so the user has no access to it. I'm thinking the best way is to store the DB as an embedded resource within the project. However, I can't figure out how to make this work.
I've added the .mdb file to the project resources and set its properties to "Embedded Resource" and "Do not copy." But now how do I reference the DB to create the connection?
Before I used the connection string "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=MyDatabase.mdb"
How do I write the connection string now with reference to an embedded resource?
"I'm thinking the best way is to store the DB as an embedded resource within the project."
This usually relates to old skool security, in the olden days DotNetNuke developers that used Access dBs as their backend actually renamed the .mdb to .resources as you cant download a resource file from the web.
"Would it be better to export the DB to xml or something like that and then use a stream reader as opposed to a database connection?"
No. You cant read an Access file from a stream And an XML dB has even less concurrency support than an Access Database.
If you really need to protect the data, then you've absolutely chosen the wrong data store.
#JohnBustos wrote "Store the DB remotely and have the program access it over the internet."
Please do not do this. If anything put it on a network share and restrict access. Then look at upgrading the access dB to SQL Server.
Yes, I have had the same problem and I converted the database into a XML or even a TXT file that is embedded. It works very fine !
Sorry, I never closed this out.
My solution was even simpler than those proposed. You can add the .mdb file to the project itself and not mess with the whole "Resource" business. Then set the file's Copy to Output property to "Do not copy". So the .mdb gets compiled into the app, but file itself is not available to the user.

How do I open / edit a .sdb file

I have a .sdb database file which I need to open. It's the database behind Song Pro (http://creationsoftware.com/).
Google seems to think that openoffice may be able to open this, as it might come from star office. But I can't persuade the file to open in Base 3.2 and there are no reliable instructions as most google results are of the extension definition type.
Initially I could do with doing this in a database browser to see how the database is laid out. But assuming it is holding the correct data I will then want to do this programmatically.
Any help much appreciated.
Thanks
Jona
This page says that the SongPro .sdb file is an MSAccess database and you can just rename it to .mdb and open it with MS Access. There's also a script linked that someone has written to convert the contents of the database.

SQL Server database recovery

I simply copied my .mdf/.ldf files to another file and suddenly my Microsoft SQL 2008 database dies. I can't open these files on another system either. Can anyone explain what's happened? Any way to recover this application's database now?
Did you stop the service or detach the files first?
You are not supposed to copy files when the server is online.
if you want to copy when the server is online, you can right click on management studio , -> detach->
then copy the files to another instance , and choose attach on new server. remember you need to know the location of the files, before you detach, also you should be knowing, also the logins need to transfer.
Have you tried moving the database files back to where they were? (Specifically, stop SQL server, move files, start SQL Server).
Whenever I do this kind of work, I make copies of the files, and rename the original ones (from, say, MyData.mdf to xMyData.mdf). Makes it easier to back out when my fatfingers take over.