Question Deploying Access Database with Application Question

lonniejohnson

Member
Joined
Feb 19, 2011
Messages
8
Programming Experience
10+
All my apps have used sql server databases on a network. I am now building one that will be installed on a stand alone machine using an MS Access database. The DB is part of my solution and all works well in testing. However, when I install the app even on the development machine it writes to my development folder and reads from the installation folder.

How do I change that?

Thanks.
 
It sounds like you have two different connection strings. This is an example of why data that gets used in multiple places should not be stored in multiple places. You should have a single connection string, probably in the config file, and then access it from that one place each time you need to use it.
 
Thanks jmcilhinney,

I was thinking it was something like that. I will look into it now. I was not sure how my original connection string got stored when I brought the Access database into the solution. It was done with a wizard. I hard coded the connection string for the script that saves my changes.

Thanks again for responding so fast.
 
If you created a Data Source then it would have stored the connection string in the config file under the name specified in the wizard. You can then access that connection string in code via My.Settings. If you want to change the connection string, either before or after deployment, then you change it in the config file.
 
jmcilhinney,

Thank you Sir. I looked in the config file and found the conn string. Modified my code for my save procedure and all is working well. As mentioned this is my first time packaging the db with the application to run as a stand-alone for a smaller app.
 
Back
Top