|
-
Jul 1st, 2012, 01:49 AM
#1
[RESOLVED] How to get the Application Path from DAL layer?
First i'll explain that i want to get the Application Path from DAL layer because i don't want to hardcode the path to my Access Database file, i can use the Settings in DAL dll to store values that won't change like database file name but Path is not always the same, it depends on installation folder. Also, I cannot use Application.StartUpPath because i'm in a DLL, not in the EXE.
I found this way is close to what i want, but the problem is that this returns the DLL file path, not the Application file path, so if the DLL is in Windows/System32 instead of the Application Path then this won't work, the blue line gets the path:
Code:
Dim connectionString As String
Dim lPath As String = New Uri(Assembly.GetAssembly(Me.GetType).CodeBase).LocalPath
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & lPath & _
"\base\" & My.Settings.DB_NAME & ";Persist Security Info=False;"
Last edited by jcis; Jul 1st, 2012 at 01:53 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|