Access MS Access database from Revit plugin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm trying to access my MS Access database with OleDbConnection in a little plugin (just for test) and it always return me the same issue.
There is my little snippets :
public UserDBManager(CPFMainModelView cmmw)
{
mainModelView = cmmw;
mainModelView.Texte = "Debut de UserDBManager";
try
{
RetrieveprojectList();
}
catch (Exception ex)
{
mainModelView.Texte += $"\n{ex.Message}\n\n{ex.StackTrace}\n\n{ex.InnerException}\n\n{ex.Data}";
}
}
public void RetrieveprojectList()
{
mainModelView.Texte += "\n-1";
using (OleDbConnection con = new OleDbConnection(connectionString))
{
mainModelView.Texte += "\n0";
con.Open();
mainModelView.Texte += "\n1";
OleDbCommand command = new OleDbCommand("SELECT Ref FROM FolderCategory", con);
mainModelView.Texte += "\n2";
OleDbDataReader reader = command.ExecuteReader();
mainModelView.Texte += "\n3";
while (reader.Read())
{
mainModelView.Texte += $"\n{reader["Ref"]}";
}
}
}
There is the different connectionString I use to connect to it :
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ThomasLECUPPRE(Letit\source\LIB_MainDB.accdb"
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\ThomasLECUPPRE(Letit\source\LIB_MainDB.accdb"
@"Driver = {Microsoft Access Driver (* .mdb, * .accdb)};Provider=Microsoft.ACE.OLEDB.12.0; DBQ = C:\Users\ThomasLECUPPRE(Letit\source\LIB_MainDB.mdb"
@"Driver = {Microsoft Access Driver (* .mdb, * .accdb)};Provider=Microsoft.Jet.OLEDB.4.0; DBQ = C:\Users\ThomasLECUPPRE(Letit\source\LIB_MainDB.mdb"
All of them return me the same issue
Debut de UserDBManager
-1
0
The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at CPF.UserDBManager.RetrieveprojectList()
at CPF.UserDBManager..ctor(CPFMainModelView cmmw)
System.Collections.ListDictionaryInternal
All this code is working for wpf app but not for revit. Why ?
I already download all Revit DB link version, and many other think I found on forums.
Thank you !