PDA

Click to See Complete Forum and Search --> : How do I path my database? - (Suggestions or rule of thumb?)


grizzly
Jun 1st, 2000, 04:29 AM
Ok, I have a VB app that accesses an Access database. The application and database are both going to be located in the same directory on the network and then accessed by a few users from networked computers.

While doing development and debug, things have been working fine because the app and database are both local on my machine. But, when I move the app and database onto the server, the data controls that I set up are currently hard pathed to my c: drive. For development, using data and bound controls, the controls need immediate access to the database in order to give me the choices for field selection for the controls.

How do I fix this problem? I would hate to have to set up all of these settings at run-time, is there a better way? I would also hate to have to go around to everyones computer and register the database with ODBC. Does anybody understand what I am even saying?

Thanks,

Shawn

Jun 1st, 2000, 05:07 AM
If you use an ODBC FILE DSN all you have to do to distribute it is copy the *.dsn file to the computers odbc DataSource directory. That can be done eaisely in your setup application(at least it is in install shield, I never use the visual studio P&D wizard). The Datasource directory by Default is c:\program files\commonfiles\odbc\datasources\

If you don't want to use odbc. create a *.ini file holding the path/s and initialize your controls at startup.

JasonGS
Jun 1st, 2000, 05:38 AM
A bit of code that has always worked good for me was as follows...

If Right$(App.Path, 1) = "\" Then myPath = App.Path Else myPath = App.Path & "\"
myFile = myPath & "filename.mdb"

Works good locally, over a network, on a train, or on a plane.