472,793 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,793 software developers and data experts.

Deploying VS 2003 Application w/Access Database

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

Jan 20 '07 #1
3 2551

"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's a
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"

Jan 20 '07 #2
"pooba53" <po*****@gmail.comschrieb
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

OleDB still needs the absolute position, but if you are looking for the
application's exe file, you find it at
System.Windows.Forms.Application.ExecutablePath

Use IO.Path.GetDirectory to extract the directory and IO.Path.Combine to
combine the directory name and the database name to build the full path used
to open the database.
Armin

Jan 21 '07 #3
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"
Jan 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt Alanzo | last post by:
On another newsgroup an Access knowledgable party posted: >You should be able to connect an Access ADP to an existing SQLExpress >database running in SQLS 2000 compatibility mode. The only thing...
1
by: Mister_d | last post by:
When deploying a solution using the Access 2003 runtime engine, do you have to use the packaging wizard that comes with the Access 2003 Developer Extentions, or can you use other packaging software...
5
by: Malcolm Webb | last post by:
Hello All, I had some considerable help from people in this forum a log while ago whilst developing a databse for use in our business. The database has developed beyond my wildest dreams over...
4
by: Michelle Stone | last post by:
I am about to deploy our application on the Internet. We will be moving our server (containing IIS and our asp.net application) to the DataCentre of our country in a few days for being online. ...
1
by: harry | last post by:
Hi all I am using VS.NET 2003 installer to deploy my ASP.NET application. I want to allow ASPNET write access to some files in subfolders of the inetpub/wwwroot/myApp/mySubfolder using VS.NET...
3
by: Rachel | last post by:
Hi, I am using the data access application block successfully in our development environment, however when I deploy to our testing server as Private Assemblies I keep getting the following ...
3
by: Rachel | last post by:
Hi, I am using the data access application block successfully in our development environment, however when I deploy to our testing server as Private Assemblies I keep getting the following ...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
3
by: adi | last post by:
Hi I only have this situation at one of my client's site. I install the webservice setup prog. Usually, i may access the asmx file from an IE browser. Not this time. My webservice uses .NET...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.