سؤال

It is possible to connect to a MS-Access mdb that is sitting outside of IIS on a regular domain folder? We have a company-wide share (S:) and am trying to do a quick a dirty connection to an mdb in a folder there. like this:

Set conn = Server.CreateObject("ADODB.Connection")
odbcName = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("S:/share/Workspaces/IntranetData/Departments/IT/public_datasignatures.mdb") & ";"
conn.mode=3
conn.open odbcName,"",""

what would I use instead of server.mappath for physical locations?

Thanks for any help, JM

هل كانت مفيدة؟

المحلول

You don't need Server.MapPath since you have a full path; but:

  • I imagine that s: will only be a mapped drive from a user login, not from IIS
  • you'll need to reference the full network path, e.g. \servername\share...
  • the account that IIS runs under will need network access to that share on the other server

You would be far better served (no pun intended!) importing that .mdb into SQL Server and connecting to it that way.

نصائح أخرى

You don't need to map at all, since you already know the exact location, so:

odbcName = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=S:/share/Workspaces/IntranetData/Departments/IT/public_datasignatures.mdb;"

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top