Re: Setting Application directory as path for database. by Jeremy
Jeremy
Thu Jul 10 10:53:57 CDT 2003
"M K" <mark@centurycolor.com> wrote in message
news:a87001c346f4$8a6d2880$a401280a@phx.gbl...
> 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