Recommendations on reading Access DB with ASP.NET

Discussion in 'Microsoft Development' started by riley, Jul 9, 2003.

  1. riley

    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.
  2. riley

    riley Perch

    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?
  3. StPatrick

    StPatrick Perch

    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:
    You can also put a hard-coded path to the database on JodoHost.
  4. WineIsGood

    WineIsGood Perch

    You can also use:
  5. Yash

    Yash Bass

    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.
  6. riley

    riley Perch

    Is the Provider portion of the connection string ok (Microsoft.Jet.OLEDB.4.0)?
  7. Yash

    Yash Bass

    Yes, the connection string looks OK. As I pointed out, your path is incorrect
  8. Yash

    Yash Bass

    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
  9. StPatrick

    StPatrick Perch

    Sure, the full connection string for Jet engine would be:

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

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services