Perhaps I'm not explaining correctly:
Within the connection string to my Access database there is a line that
looks like this:
Data Source=""C:\Documents and Settings\usrdel\My Documents\Visual " &
_
"Studio Projects\Debt Accelerator\data.mdb""
So when I build my project for deployment and install it on another
computer, it looks for the Access database at the above location
instead of the directory where my VB executable and the Access database
is located.
Is there a way to make this connection string relative instead of
absolute? How are folks deploying their applications that include a
database? Seems like one should be able to move the application
directory containing the executable and the database wherever the hell
you want and still work.
Can I provide any more information?
Thanks.
pvdg42 wrote:
"pooba53" <po*****@gmail.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
I have a VB .NET 2003 application that communicates with an Access db.
I am deploying the application using the Wizard that creates an install
package and it IS properly grabbing the Access db and putting it in the
Program Files directory along with the application executable, no
problem.
The problem is this...
The OleDbConnection knows of the database in an absolute location (i.e.
C:\Documents and Settings\ApplicationDB\data.mdb
So whenever I install and launch the application on another machine, it
looks for the database at the location I just mentioned. Well, I have
the database in the same directory as the application .exe file.
I need to be able to use a reference to the database based on relative
position I guess rather than absolute location.
Anybody know how to configure this?
Thanks...this group has been very helpful.
-Dan
One way to address you problem is use of a relative path instead of the
absolute path.
You can Google (groups) up numerous articles on relative path, but here'sa
quote that may be of interest:
If the database path is relative to the location of your application
(executable) path then use the
following:
Dim DatabasePath As String
Dim FileInfoPath = New
System.IO.FileInfo(System.Reflection.Assembly.GetE xecutingAssembly.Location*)
DatabasePath = FileInfoPath.Directory.FullName & "\Database"