In classic ASP I could specify a relative path (server side mapping) or
absolute path to an Access database file. I can connect to an access file
with no problems using the absolute path of "C:\Inetpub\wwwroot\db\mydb.mdb"
in ASPNET, but I'm scratching my head on how to specify a server path instead.
For example in classic ASP:
dbDriver = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("\data\inventory.mdb")
How can I specify the database connection string in ASPNET without using the
full complete path file location? Thanks in advance.
Cowboy (Gregory A. Beamer) - MVP - 14 Jul 2005 17:55 GMT
One option: As you build your connection string, you can use MapPath() to map
the relative path to an absolute path.

Signature
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
> In classic ASP I could specify a relative path (server side mapping) or
> absolute path to an Access database file. I can connect to an access file
[quoted text clipped - 7 lines]
> How can I specify the database connection string in ASPNET without using the
> full complete path file location? Thanks in advance.
Juan T. Llibre - 14 Jul 2005 20:26 GMT
Instead of :
> dbDriver = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
> Server.MapPath("\data\inventory.mdb")
use :
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\data\inventory.mdb;User
Id=admin;Password=;"
If your password is not blank, use :
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\data\inventory.mdb;Jet OLEDB:Database
Password=pwd;"
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
> In classic ASP I could specify a relative path (server side mapping) or
> absolute path to an Access database file. I can connect to an access file
[quoted text clipped - 7 lines]
> How can I specify the database connection string in ASPNET without using the
> full complete path file location? Thanks in advance.
Sisnaz - 15 Jul 2005 18:50 GMT
> Instead of :
>
[quoted text clipped - 29 lines]
> > How can I specify the database connection string in ASPNET without using the
> > full complete path file location? Thanks in advance.
Thank you for the help and quick replies. Your answer worked great. Thanks
again.
Juan T. Llibre - 15 Jul 2005 21:32 GMT
re:
> Thank you for the help and quick replies. Your answer worked great.
Great!
Good to know that fit the bill...
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
>> Instead of :
>>
[quoted text clipped - 32 lines]
> Thank you for the help and quick replies. Your answer worked great. Thanks
> again.
Robert Smith - 16 Jul 2005 16:53 GMT
For example in classic ASP:
dbDriver = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("\data\inventory.mdb")
> In classic ASP I could specify a relative path (server side mapping) or
> absolute path to an Access database file. I can connect to an access file
[quoted text clipped - 7 lines]
> How can I specify the database connection string in ASPNET without using the
> full complete path file location? Thanks in advance.