Failed to open MS Access DataBase In Revit 2021
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?