ASPNET Access Connection String Question

G

Guest

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.
 
G

Guest

One option: As you build your connection string, you can use MapPath() to map
the relative path to an absolute path.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
J

Juan T. Llibre

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;"
 
G

Guest

Juan T. Llibre said:
Instead of :


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;"
Thank you for the help and quick replies. Your answer worked great. Thanks
again.
 
R

Robert Smith

For example in classic ASP:
dbDriver = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("\data\inventory.mdb")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top