0
votes

I am using Visual Studio 2012 to create a Web application that connects to an Access 2013 database with following programming line:

string connectionString = "provider=Microsoft.ACE.OLEDB.12.0;" + "data source=" + Page.Server.MapPath("App_Data\\db1.accdb");

But it failed to launch it due to the error

Microsoft.ACE.OLEDB.12.0 is not found in local machine

What is the correct connection string for Microsoft Access 2013?

4
Have you verified that Page.Server.MapPath() returns a valid path because otherwise this connection string seems fine. You can find connections strings here. - BenFradet
that is my database allocate i already verify - wesleylim1993
I made another edit to my answer. - Gord Thompson

4 Answers

4
votes

The machine acting as the web server must have the "Microsoft Access Database Engine 2010" installed. If that machine does not have Access installed on it then you can download the installer for the engine here.

Note that the 64-bit installer includes the 64-bit version only; it does not include the 32-bit version (available separately on that same page).

edit...

As for the connection string, I just tested the following VBScript on my Access_2013 machine and it worked fine.

Option Explicit
Dim con, rst
Set con = CreateObject("ADODB.Connection")
con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Gord\Desktop\Database1.accdb;Persist Security Info=False;"
Set rst = CreateObject("ADODB.Recordset")
rst.Open "SELECT Col1 FROM Table1", con
Wscript.Echo rst(0).Value
rst.Close
Set rst = Nothing
con.Close
Set con = nothing

I copied the connection string from connectionstrings.com.

edit...

If you have access to the web server, you can check for the existence of the following two files:

C:\Program Files\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL

C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL

On a 64-bit machine the first file indicates that the 64-bit version of the Access Database Engine is installed. On a 32-bit machine it indicates that the 32-bit version is installed.

If the second (x86) file exists then you know that the 32-bit version of the Access Database Engine is present on a 64-bit machine.

edit re: final comment

The problem was indeed related to the "bitness" of the Access Database Engine:

i install "Microsoft Access Database Engine 2010" 64 bit i should install 32bit due to my visual studio is 32bit thanks for the advice

0
votes

It depends with the office you have installed, if you have x64 bit office then you must compile the application as a x64 to allow it to run, so if you want it to run on x36 then you must install office x86 to accept, i tried all the solutions above but none worked until when i realised i had office x64bit and so i built the application as x64 and worked.

I also realised that if you put it to any cpu but do not set to prefere 32 bit also works

0
votes

Let the provider to 12.0 it works for ACCESS 2013

just install these 2 elements:

1)Microsoft Access 2013 Runtime: https://www.microsoft.com/en-us/download/details.aspx?id=39358

then

2)microsoft access database engine 2007: https://www.microsoft.com/en-us/download/details.aspx?id=23734

PS: x86 for 32bits & x64 for 64bits.

-1
votes

here use this

provider=Microsoft.ACE.OLEDB.15.0

this is the connection string for ms access 2013