Failed to open MS Access DataBase In Revit 2021

Failed to open MS Access DataBase In Revit 2021

bim01
Contributor Contributor
1,042 Views
3 Replies
Message 1 of 4

Failed to open MS Access DataBase In Revit 2021

bim01
Contributor
Contributor

Failed to open MS Access DataBase In Revit 2021

public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{   
   string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=";
   connectionString += @"C:\Users\admin\Desktop\test.accdb";
   
   using (OleDbConnection connection = new OleDbConnection(connectionString))
   {
       try
       {
           connection.Open();//Failed here, no error message was catched,
           
       }
       catch (Exception ex)
       {
           MessageBox.Show("error", ex.Message);
       }                
   }
   return Autodesk.Revit.UI.Result.Succeeded;
}

1.My environment: Win 10 , Revit 2021, Visual studio 2019 , Target Platform: AnyCPU, AccessDataBaseEngine 2016 X64 version:16.0.5044.1000
2.Revit was got stuck at "connection.Open()" and exit 5 seconds later, no error message was catched.
3.I did the following test, I put the same code in a console application without Revit environment, when the Target Platform was set to "Any Cpu", it throw the error:'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine
4.Then I set the Target Platform to X64, the console application open the Access Database successfully.
5.Then I did the same thing to set the Target Platform to X64 in Revit external application project,it still failed to open

It seems that someone has the same problem without solution?

https://forums.autodesk.com/t5/revit-api-forum/connection-to-ms-access-database/m-p/7908865/highligh... 

1,043 Views
3 Replies
Replies (3)
Message 2 of 4

m_franken
Explorer
Explorer

Hi,

 

Did You solve this? I have the same problem in Revit 2018

 

Cheers Marc

0 Likes
Message 3 of 4

Revitalizer
Advisor
Advisor

Hi,

 

recently, I faced the same problem.

 

This helped me:

 

https://stackoverflow.com/questions/28866648/connect-to-a-32-bit-access-database-from-64-bit-net-pro...

 

"Uninstalling office and installing the 64-bit Access Database Engine worked perfectly! No changes need to existing code, ..."

 

In my case, I just installed the driver and did not uninstall office.

 

 

Regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 4 of 4

Revitalizer
Advisor
Advisor

Hi all,

 

after a Windows update, the problem occurred again.

Installing the driver another time, fixed the issue, as before.

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine