Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2005

Tip: Looking for answers? Try searching our database.

ASPNET Access Connection String Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sisnaz - 14 Jul 2005 17:47 GMT
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.

 

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.