Hi,
How can I point or target my access database in a safe way? Meaning, if I'm going to change my project to another computer, it will not cause any connection problem to my database. Thanks in advance. :)

Recommended Answers

All 3 Replies

You need to store the database file in application path.

how can i use that with this.,

provider = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source="
            dataFile = "C:\Users\kg\Documents\testDB.accdb"            connString = provider & dataFile

I just added it as a resource in visual studio 2010

1.Go to Projects
2.Then Locatate where it says yourprojectname properties
3.Locate the Resources Tab
4.Click Add Resource in resources tab
5.Locate Database it will appear under files(after you located and added)
6.When you add a wizard should pop up choose dataset then check all the tables you want to use
7.in My Docuemts/Visual Studio 2010/Projects/yourprojectname/yourprojectname/bin/release should be a folder name resources with all the data needed to run on another computer keep it there
8. Ill modify your code to make it work with the short tut i wrote

provider = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source="
            dataFile = "Resources\testDB.accdb"            connString = provider & dataFile

9.Test It on another computer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.