Recommendations on reading Access DB with ASP.NET

riley

Perch
I'm trying to read my Access database in ASP.Net and I'm having some difficulty. It works on my system, but not on jodo. Hence, I must be doing something wrong.

I'm using a System.Data.OleDb.OleDbDataAdapter and the following connection string:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mydatabase & ";Mode=Share Deny None"
I'm getting mydatabase by concatenating System.Web.HttpRuntime.AppDomainAppPath with my dbfolder\ and databasename (using backslash). This is not working.

Any suggestions?

Also, any recommendations on where to put database files? At other hosts, I used to put them in a folder off the root, but I had control over permissions.

Any help would be greatly appreciated.
 
Here is a true sign that I am confused: I'm responding to my own posts...

I had some reservations about using System.Web.HttpRuntime.AppDomainAppPath, so I changed a few things. I moved my database to the root folder "/" and used Server.MapPath(/mydatabase ) to get the path to use in the connection string. The only good news is that the results were consistant: it works on my system but not at jodo.

Any thoughts?
 
Well, I'd tell you what I did, maybe it'll help.

First I've created a folder (named it Data), just above the web root. Then asked JodoHost support to give the folder write permissions (for ASP.NET they are not set by default). Now all my Access databases, XML files go to that folder. After that I asked support to enable "parent paths", so I can use MapPath in this manner:
Code:
Server.MapPath("/../Data/mydb.mdb");

You can also put a hard-coded path to the database on JodoHost.
 
Originally posted by riley
I moved my database to the root folder "/" and used Server.MapPath(/mydatabase ) to get the path to use in the connection string.

It should be Server.MapPath(../mydatabase.mdb)

Also, for parent paths ("..") to work, you must submit a ticket. We will have to manually activate it for you on your domain.
 
That connection string is correct from my rough knowledge of ASP. We are all mainly system administrators here. If you'd like to ask a question about our systems, I'd be glad to help. If you want help with ASP, I'm sure other customers could help you or you could try posting it at madasp.com
 
Sure, the full connection string for Jet engine would be:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=your_db_path_here
 
Back
Top