Setting Application directory as path for database.

  • Thread starter Thread starter M K
  • Start date Start date
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?
 
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
 
Back
Top