Setting Application directory as path for database.

M

M K

I want to set my application's database path to the
directory that the application resides in so that any
location I install this application will look to the
installation directory, instead of where I have the file
located on my system. (ie C:\Documents and
Folders\Users\Current User...)

I am setting this at design time using the properties
window for the OleDb connection. Can I do this? If not how
do I do it?
 
J

Jeremy Cowles

M K said:
I want to set my application's database path to the
directory that the application resides in so that any
location I install this application will look to the
installation directory, instead of where I have the file
located on my system. (ie C:\Documents and
Folders\Users\Current User...)

I am setting this at design time using the properties
window for the OleDb connection. Can I do this? If not how
do I do it?

You have an initial value at Design time, then you update the connection
string at Runtime with the actual value. You can get the path your app is
running in like this:

Dim AppPath as String = New IO.DirectoryInfo(New
IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly.Location).Direct
ory.FullName).FullName & "\"



HTH,

Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top