473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 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 2597

"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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.