Connection String

W

William Gower

How do I set up the connection string for an access database? I don't want
to access the physical location. I want to access the database in the
private directory of the Unit12 location on the server.

Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;"

strConnection += "Data Source=c:\inetpub\wwwroot\Unit12\private\union.mdb;"

Application("strConnection") = strConnection
 
S

Scott M.

If the directory exists in the same web application that you are calling it
from, use:

"Data Source=" & Server.MapPath(relativePathToDB)
 
W

William Gower

I am getting an error when I try to update a database using the following
value for the connection string. the private directory is read/write. I
assumed it was because I was trying to update the database using the
physical path.

c:\inetpub\wwwroot\Unit12\private\Union.mdb

Operation must use an updateable query.
 
S

Scott M.

No, you can update a db using its physical path (although not a good idea
from a security standpoint). We need to see your code to be of any more
help.
 
P

Paul Clement

¤ I am getting an error when I try to update a database using the following
¤ value for the connection string. the private directory is read/write. I
¤ assumed it was because I was trying to update the database using the
¤ physical path.
¤
¤ c:\inetpub\wwwroot\Unit12\private\Union.mdb
¤
¤ Operation must use an updateable query.

You probably do no have sufficient permissions (this would appear to be an ASP.NET app).

PRB: Cannot connect to Access database from ASP.NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;316675


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

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

Top