Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data access

Status
Not open for further replies.

nina1

Programmer
Aug 14, 2001
31
CA
I packed my app that was instaled on D:/My folder with PDW
and when I was trying to instal it on another mashine, it looks for database from my folder like D:/My folder/My database.
How can I change connection to database , so that it looks for database from my app. not from developer folder.
Please if someone can help me. I am beginner in VB.
Thanks.
 
You've obviously either hardcoded the location of your database in your source code or you've set a property on a data-bound control pointing to you're database. What you need to do is store where the user installs the app in an 'ini' file which you create on installation in the Windows directory. Then when running the app, it should go and look in the ini file for the loction of the database (installation directory)

Hope this helps
John B
 
... Or

In your connection string, use App.Path (to point to the folder that the program is running in).

i.e. - location = App.Path & "\" & DBFolder & "\" & DBFileName

jason
 
Thanks !
Jbrowne please if you can explain me a little bit more how to do that.
 
Actually, jasek78's suggestion is much better. To use an ini file you would need to be storing and using much more information than just the installation location for it to be worth the effort. You have to use Windows API calls and then write routines for reading and writing to the ini file etc, etc.
Go with Jason's idea, its much simplier and a better opinion for your needs.

John B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top