Problem:When i try to create MS Access database (.mdb) file, I am getting an error "Class not registered at ADOX.CatalogClass.Create(String ConnectString) from Microsoft OLE DB Service Components". I am using below C# code to create MS Access .mdb file using OLEDB Connection.
ADOX.Catalog cat = new ADOX.Catalog(); cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\test.mdb");Received below error message:
Class not registered : at ADOX.CatalogClass.Create(String ConnectString) at MyApp.DB.CreateDatabase()
Solution 1:The OLEDB provider is supported only 64 bit application, so, to fix this problem, we have to change our application's build configuration to 32 bit mode.
Solution 2:For me, the problem solved after changing my C# project's build configuration to x86 platform. If you received this error from IIS Server, follow the below steps to fix the issue.
- Go to IIS and Application Pools in the left menu.
- Right-click on the problematic Application Pool.
- Click Advanced Settings.
- In General Tab, make the Enable 32 Bit Applications entry to "True"