Locating updated external database. Visual Basic

(Apologies in advance if this has been answered previously; I just couldn't find it, if it was.)

I have a VB 2013 Express for Desktop app that reads and writes to an Access 2010 database. That is all working just fine. In fact I can publish it and it works fine. (I guess.) And it took me FOREVER to find a way to get the file to come along with the published app. (I finally "added" the file to my Solution; set the Build action to Content; and the Copy to Output Directory to Copy Always). Well, the published program runs fine and I can make changes to the database as shown by fields on my form that display the updated data.

Wow, was I excited. Except....I'd like to find where that updated file is on my hard drive. Because if my client updates that database I want to get a copy of that database to replace MY (now out-of-date) copy.

No clue as to how to find that updated file (if it exists). Maybe I'm doing something else wrong, too. But I need SPECIFIC instructions on how to do it (i.e., not a lot of tech-talk; I don't do this very often so, while competent I'm not an polished expert).I DID find the file with this appendage: .deploy.
author3000Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
Check the location of your database in your "output directory", usually the bin, bin/Debug or bin/Release, depending on the version of Visual Studio you use and your way of working. This could have been changed however if you changed the properties of your project.

Usually, the database file ends up in the same directory as the application itself. If this is so for you "output", then it should be the same on your client side once it has been deployed.

When an application is running, calling Application.ExecutablePath in your code shows you the directory in which the application is installed. So, assuming that everything goes with the most usual way of distributing a database with a simple application, the database is in the same directory.

If this is your case, simply add a button or menu option in your application that calls Application.ExecutablePath and display or save the result somewhere you can grab it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
author3000Author Commented:
Well, well, well. what a deal. The path to the file is this:

C:\Users\TheDad\AppData\Local\Apps\2.0\X3EWETCO.58H\XA1RMCMM.BY1\glyp..tion_0021903f6689be8c_0001.0000_5f5ab15fe4d3cd64\Glyphs.accdb

MY GOOD LORD!

I'm going to award you the points. BUT would you be so kind as to tell me how to get that stinking file to store somewhere else into a folder that is reasonable? Like C:\StoredGlyphs.
0
Jacques Bourgeois (James Burger)PresidentCommented:
The word publish is used for anything nowadays (even paper books :-)) so I did not make the connection right there. You deployed your application with ClickOnce, didn't you?

Well, that strange path is is what ClickOnce does. For all its versatility, you have to pay a little bit. One of these "payments" is that you have no control over the path where stuff is deployed. Because it handles things by itself, ClickOnce has its own way of keeping track of the different versions of the application, and this way involves these strange directories.

Which brings another problem that you have not encountered yet. ClickOnce creates a new directory, with a new name,  with each update, and installs the new version there. This enables that wonderful feature that permits a user to rollback an installation if an update happens to do bad things. But this means that installing the database in the same directory as the application is not a good idea with ClickOnce, specially if you want to act on it from outside as is your case.

What I did when I deployed Access databases with ClickOnce was to start my applications with the following algorithm:

- Check if the database file exists in a specific directory of my choosing.
- If if does not, copy the database file that was distributed with the application in that directory.
- If it does exist, then do nothing, the database is already "installed".
- Set my ConnectionString to that location.

This installed the database only on the first run of the application, in a specific place that I could easily access and that did not change name everytime I deployed an update.
0
author3000Author Commented:
Wow! What a great idea for locating the database! I just want the user to be able to easily find the DB so we can exchange updates and just update the DB without fiddling with the entire application. Thank you a lot. I wish I'd posted this before I had wasted tons of time Google-ing to find the solutions you provided.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.