473,513 Members | 3,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Relative path to Access db

dw
Hello, all. I have a site that I'm testing on my LOCALHOST and also on a
remote server, depending on whether I'm at work or at home. I don't want the
OLEDBDATAAdapter to be pointing to the remote Access db, but to the local
one. The OLEDBDATAAdapter wizard puts the entire path of the db
(\\myserver\.... or c:\myprojects\....).

The db resides within the site's folders; is there anyway to use relative
paths for it (something like "global/data/project1.mdb")? Thanks :)
Nov 18 '05 #1
8 1950
Store the relative path in your web.config and do a Server.MapPath to get
the full path to the file...

Karl

"dw" <co***************@uncw.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello, all. I have a site that I'm testing on my LOCALHOST and also on a
remote server, depending on whether I'm at work or at home. I don't want the OLEDBDATAAdapter to be pointing to the remote Access db, but to the local
one. The OLEDBDATAAdapter wizard puts the entire path of the db
(\\myserver\.... or c:\myprojects\....).

The db resides within the site's folders; is there anyway to use relative
paths for it (something like "global/data/project1.mdb")? Thanks :)

Nov 18 '05 #2
dw
Thanks, Karl. What would I modify in my web.config file? Thanks.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:uj**************@tk2msftngp13.phx.gbl...
Store the relative path in your web.config and do a Server.MapPath to get
the full path to the file...

Karl

"dw" <co***************@uncw.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello, all. I have a site that I'm testing on my LOCALHOST and also on a
remote server, depending on whether I'm at work or at home. I don't want

the
OLEDBDATAAdapter to be pointing to the remote Access db, but to the local one. The OLEDBDATAAdapter wizard puts the entire path of the db
(\\myserver\.... or c:\myprojects\....).

The db resides within the site's folders; is there anyway to use relative paths for it (something like "global/data/project1.mdb")? Thanks :)


Nov 18 '05 #3
Dim cn As OleDb.OleDbConnection

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath(ConfigurationSettings.AppSettings(" path"))) ' -->>>
c:\inetpub\wwwroot\global\data\project1.mdb

web.config...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="path" value="/global/data/project1.mdb" />
</appSettings>

<system.web>
.... etc

HTH,
Greg

"dw" <co***************@uncw.edu> wrote in message
news:er**************@TK2MSFTNGP09.phx.gbl...
Thanks, Karl. What would I modify in my web.config file? Thanks.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:uj**************@tk2msftngp13.phx.gbl...
Store the relative path in your web.config and do a Server.MapPath to get
the full path to the file...

Karl

"dw" <co***************@uncw.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello, all. I have a site that I'm testing on my LOCALHOST and also on a remote server, depending on whether I'm at work or at home. I don't
want the
OLEDBDATAAdapter to be pointing to the remote Access db, but to the

local one. The OLEDBDATAAdapter wizard puts the entire path of the db
(\\myserver\.... or c:\myprojects\....).

The db resides within the site's folders; is there anyway to use relative paths for it (something like "global/data/project1.mdb")? Thanks :)



Nov 18 '05 #4
dw
Wow! Didn't know you could do that. Exactly what I was looking for. Thanks,
Greg :)

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:OA**************@TK2MSFTNGP11.phx.gbl...
Dim cn As OleDb.OleDbConnection

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath(ConfigurationSettings.AppSettings(" path"))) ' -->>>
c:\inetpub\wwwroot\global\data\project1.mdb

web.config...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="path" value="/global/data/project1.mdb" />
</appSettings>

<system.web>
... etc

HTH,
Greg

"dw" <co***************@uncw.edu> wrote in message
news:er**************@TK2MSFTNGP09.phx.gbl...
Thanks, Karl. What would I modify in my web.config file? Thanks.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:uj**************@tk2msftngp13.phx.gbl...
Store the relative path in your web.config and do a Server.MapPath to
get the full path to the file...

Karl

"dw" <co***************@uncw.edu> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> Hello, all. I have a site that I'm testing on my LOCALHOST and also
on a > remote server, depending on whether I'm at work or at home. I don't want the
> OLEDBDATAAdapter to be pointing to the remote Access db, but to the

local
> one. The OLEDBDATAAdapter wizard puts the entire path of the db
> (\\myserver\.... or c:\myprojects\....).
>
> The db resides within the site's folders; is there anyway to use

relative
> paths for it (something like "global/data/project1.mdb")? Thanks :)
>
>



Nov 18 '05 #5
Another useful tip is to use comments in your web.config so you can just
uncomment your other "path" when you switch locations, lot less typing...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--
<add key="path" value="/global/data/project1.mdb" />
-->
<add key="path" value="/global/data/project2.mdb" />

</appSettings>

<system.web>

Greg

"dw" <co***************@uncw.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
Wow! Didn't know you could do that. Exactly what I was looking for. Thanks, Greg :)

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:OA**************@TK2MSFTNGP11.phx.gbl...
Dim cn As OleDb.OleDbConnection

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath(ConfigurationSettings.AppSettings(" path"))) ' -->>>
c:\inetpub\wwwroot\global\data\project1.mdb

web.config...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="path" value="/global/data/project1.mdb" />
</appSettings>

<system.web>
... etc

HTH,
Greg

"dw" <co***************@uncw.edu> wrote in message
news:er**************@TK2MSFTNGP09.phx.gbl...
Thanks, Karl. What would I modify in my web.config file? Thanks.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:uj**************@tk2msftngp13.phx.gbl...
> Store the relative path in your web.config and do a Server.MapPath to get
> the full path to the file...
>
> Karl
>
> "dw" <co***************@uncw.edu> wrote in message
> news:%2****************@tk2msftngp13.phx.gbl...
> > Hello, all. I have a site that I'm testing on my LOCALHOST and
also
on
a
> > remote server, depending on whether I'm at work or at home. I

don't want
> the
> > OLEDBDATAAdapter to be pointing to the remote Access db, but to

the local
> > one. The OLEDBDATAAdapter wizard puts the entire path of the db
> > (\\myserver\.... or c:\myprojects\....).
> >
> > The db resides within the site's folders; is there anyway to use
relative
> > paths for it (something like "global/data/project1.mdb")? Thanks :) > >
> >
>
>



Nov 18 '05 #6
Greg...an even better idea is to use a user.config file on one of the
machines to overwrite the default setting in the web.config

web.config -->
<appSettings file="user.config">
<a key="path" value="blah" />
</appSettings>

user.config -->
<appSettings>
<a key="path" value="otherblah" />
</appSettings>

if the user config is present, it'll return otherblah as the value..Great
for team development.

Karl

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
Another useful tip is to use comments in your web.config so you can just
uncomment your other "path" when you switch locations, lot less typing...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--
<add key="path" value="/global/data/project1.mdb" />
-->
<add key="path" value="/global/data/project2.mdb" />

</appSettings>

<system.web>

Greg

"dw" <co***************@uncw.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
Wow! Didn't know you could do that. Exactly what I was looking for. Thanks,
Greg :)

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:OA**************@TK2MSFTNGP11.phx.gbl...
Dim cn As OleDb.OleDbConnection

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" & Server.MapPath(ConfigurationSettings.AppSettings(" path"))) ' -->>>
c:\inetpub\wwwroot\global\data\project1.mdb

web.config...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="path" value="/global/data/project1.mdb" />
</appSettings>

<system.web>
... etc

HTH,
Greg

"dw" <co***************@uncw.edu> wrote in message
news:er**************@TK2MSFTNGP09.phx.gbl...
> Thanks, Karl. What would I modify in my web.config file? Thanks.
>
> "Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote
in
> message news:uj**************@tk2msftngp13.phx.gbl...
> > Store the relative path in your web.config and do a Server.MapPath

to get
> > the full path to the file...
> >
> > Karl
> >
> > "dw" <co***************@uncw.edu> wrote in message
> > news:%2****************@tk2msftngp13.phx.gbl...
> > > Hello, all. I have a site that I'm testing on my LOCALHOST and also
on
a
> > > remote server, depending on whether I'm at work or at home. I

don't want
> > the
> > > OLEDBDATAAdapter to be pointing to the remote Access db, but to the > local
> > > one. The OLEDBDATAAdapter wizard puts the entire path of the db
> > > (\\myserver\.... or c:\myprojects\....).
> > >
> > > The db resides within the site's folders; is there anyway to use
> relative
> > > paths for it (something like "global/data/project1.mdb")? Thanks :) > > >
> > >
> >
> >
>
>



Nov 18 '05 #7
Awesome! Not sure how I overlooked that all this time.

Greg

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:uH*************@TK2MSFTNGP09.phx.gbl...
Greg...an even better idea is to use a user.config file on one of the
machines to overwrite the default setting in the web.config

web.config -->
<appSettings file="user.config">
<a key="path" value="blah" />
</appSettings>

user.config -->
<appSettings>
<a key="path" value="otherblah" />
</appSettings>

if the user config is present, it'll return otherblah as the value..Great
for team development.

Karl

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
Another useful tip is to use comments in your web.config so you can just
uncomment your other "path" when you switch locations, lot less typing...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--
<add key="path" value="/global/data/project1.mdb" />
-->
<add key="path" value="/global/data/project2.mdb" />

</appSettings>

<system.web>

Greg

"dw" <co***************@uncw.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
Wow! Didn't know you could do that. Exactly what I was looking for.

Thanks,
Greg :)

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:OA**************@TK2MSFTNGP11.phx.gbl...
> Dim cn As OleDb.OleDbConnection
>
> cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
&
> Server.MapPath(ConfigurationSettings.AppSettings(" path"))) ' -->>>
> c:\inetpub\wwwroot\global\data\project1.mdb
>
> web.config...
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <appSettings>
> <add key="path" value="/global/data/project1.mdb" />
> </appSettings>
>
> <system.web>
> ... etc
>
> HTH,
> Greg
>
> "dw" <co***************@uncw.edu> wrote in message
> news:er**************@TK2MSFTNGP09.phx.gbl...
> > Thanks, Karl. What would I modify in my web.config file? Thanks.
> >
> > "Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>

wrote in
> > message news:uj**************@tk2msftngp13.phx.gbl...
> > > Store the relative path in your web.config and do a Server.MapPath to
> get
> > > the full path to the file...
> > >
> > > Karl
> > >
> > > "dw" <co***************@uncw.edu> wrote in message
> > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > Hello, all. I have a site that I'm testing on my LOCALHOST and

also
on
> a
> > > > remote server, depending on whether I'm at work or at home. I

don't
> want
> > > the
> > > > OLEDBDATAAdapter to be pointing to the remote Access db, but
to the
> > local
> > > > one. The OLEDBDATAAdapter wizard puts the entire path of the
db > > > > (\\myserver\.... or c:\myprojects\....).
> > > >
> > > > The db resides within the site's folders; is there anyway to use > > relative
> > > > paths for it (something like "global/data/project1.mdb")?

Thanks :)
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #8
I'm resurrecting this thread because I need some clarification on settings.
So I too have made the db connection using th ui(designer) I check the
properties of the oledbconnection and can see the connection string. I can
also choose <dynamic properties> and add a key to the web.config with the
connection string (e.g. <add "dbConnect" value"string" />)

Now what I want to know is how do i use that config in place of the designer
generated string and how can I modify it to use a relative path (i.e.
server.mappath)

cheers
"Greg Burns" wrote:
Awesome! Not sure how I overlooked that all this time.

Greg

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:uH*************@TK2MSFTNGP09.phx.gbl...
Greg...an even better idea is to use a user.config file on one of the
machines to overwrite the default setting in the web.config

web.config -->
<appSettings file="user.config">
<a key="path" value="blah" />
</appSettings>

user.config -->
<appSettings>
<a key="path" value="otherblah" />
</appSettings>

if the user config is present, it'll return otherblah as the value..Great
for team development.

Karl

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
Another useful tip is to use comments in your web.config so you can just
uncomment your other "path" when you switch locations, lot less typing...
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--
<add key="path" value="/global/data/project1.mdb" />
-->
<add key="path" value="/global/data/project2.mdb" />

</appSettings>

<system.web>

Greg

"dw" <co***************@uncw.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
> Wow! Didn't know you could do that. Exactly what I was looking for.
Thanks,
> Greg :)
>
> "Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
> news:OA**************@TK2MSFTNGP11.phx.gbl...
> > Dim cn As OleDb.OleDbConnection
> >
> > cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data

Source="
&
> > Server.MapPath(ConfigurationSettings.AppSettings(" path"))) ' -->>>
> > c:\inetpub\wwwroot\global\data\project1.mdb
> >
> > web.config...
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> > <appSettings>
> > <add key="path" value="/global/data/project1.mdb" />
> > </appSettings>
> >
> > <system.web>
> > ... etc
> >
> > HTH,
> > Greg
> >
> > "dw" <co***************@uncw.edu> wrote in message
> > news:er**************@TK2MSFTNGP09.phx.gbl...
> > > Thanks, Karl. What would I modify in my web.config file? Thanks.
> > >
> > > "Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>

wrote
> in
> > > message news:uj**************@tk2msftngp13.phx.gbl...
> > > > Store the relative path in your web.config and do a Server.MapPath to
> > get
> > > > the full path to the file...
> > > >
> > > > Karl
> > > >
> > > > "dw" <co***************@uncw.edu> wrote in message
> > > > news:%2****************@tk2msftngp13.phx.gbl...
> > > > > Hello, all. I have a site that I'm testing on my LOCALHOST and
also
> on
> > a
> > > > > remote server, depending on whether I'm at work or at home. I
don't
> > want
> > > > the
> > > > > OLEDBDATAAdapter to be pointing to the remote Access db, but to the
> > > local
> > > > > one. The OLEDBDATAAdapter wizard puts the entire path of the db > > > > > (\\myserver\.... or c:\myprojects\....).
> > > > >
> > > > > The db resides within the site's folders; is there anyway to use > > > relative
> > > > > paths for it (something like "global/data/project1.mdb")? Thanks :)
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #9

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

Similar topics

1
1570
by: olorin_press | last post by:
I have an Access 2000 database in which I display various graphics for each record. I store all the images in a folder ("Images") which is a subdirectory to the directory in which the .mdb is stored. In the table ("Aircraft") behind my form, I have a field in which I store the path to the image to be displayed for each record. This works...
1
5346
by: Prateek | last post by:
Hi, I am using appSettings in Web.Config to store my connection string. However, I am not able to provide a relative path to the Access database. How can I do that? TIA Prateek
6
11747
by: openleren | last post by:
Hi all, how can I use a relative path in my web.config file for an Access db?: Instead of using <configuration> <appSettings> <add key="conAccess" value="microsoft.jet.oledb.4.0;data source=c:/Inetpub/MyApp/data/database.mdb" /> ...
8
3444
by: Daniel Serrano | last post by:
Hi, is it possible to use a relative path in a Connection string to access an Access database in a stand alone visual basic desktop application. All the examples that I have seen have absolute paths but my application could be a lot more flexible if it didn't depend on this. Thanks, Daniel Serrano
3
5787
by: bobdydd | last post by:
Hi Everybody Access 2000, Outlook 2000 Windows XP I am running the code below to open Microsoft Outlook from a Command Button. It works fine until I tried it on a machine that has Office installed on something other than the "C" drive. So can anyone advise me how to open Outlook by using a relative path rather than the code I am using...
2
10401
by: Ruymán | last post by:
Hello!, is possible use relative path in access? for example use "photo\image1.jpg" instead of "c:\db\photo\image1.jpg", I try it but I cann't, but in Visual Basic if is possible. Other question but relationated, Is posible don´t put a path to the picture in the image control (in desing) ? The Database will be move frecuntly and it...
8
2592
by: JJ | last post by:
I'm confused about paths. I have a functionn that uses the mappath method, which I think requires a virtual path (is that the same as a relative path?). But this doesn't always work as the path can take the form of the following: 1. /directory/images/xyz.gif (works fine) 2....
0
1376
by: M Cavanagh | last post by:
I am fairly new using functions to return file info and I made an assumption that a function working on a local machine would work fine on a server. I have searched several Access books to find a how one can use reference a relative path in an application. I found a function in Access Dev Handbook which in fact returns a relative path but...
15
6435
by: Lars Eighner | last post by:
Aside from the deaths of a few extra electrons to spell out the whole root relative path, is there any down side? It seems to me that theoretically it shouldn't make any difference, and it would make it much easier to slap modualar blocks of markup into page frameworks, which may change and so forth. And the few extra bytes, which even for a...
0
7270
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7397
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7125
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7543
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.