0

I'm having an issue with my connection string using MVC 4 and access DB. When I use the provider name - System.Data.OleDb I still receive an error and when I remove it I get the below error. I used the connection string from connectionstrings.com.

Any help is much appreciated. Thanks

Here is the error: The connection string 'EmployeeContext' in the application's configuration file does not contain the required providerName attribute."

Here is the connection string:

<add name="EmployeeContext" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\Databases\EmployeeDb.mdb"/>
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
Troy Bryant
  • 994
  • 8
  • 29
  • 60
  • Are you using EntityFramework? – mmilleruva May 12 '14 at 14:03
  • Yes added the references and still searching for answers – Troy Bryant May 12 '14 at 14:16
  • If it's any help my connection string for an EF connection looks like this: . This is using SQL Server as the database, but shows the providerName attribute. I usually let Vistal Studio create the connection strings. – Nigel Ellis May 12 '14 at 14:29
  • 1
    possible duplicate of [Does Microsoft Jet DB work with Entity Framework?](http://stackoverflow.com/questions/11197259/does-microsoft-jet-db-work-with-entity-framework) – Gord Thompson May 12 '14 at 14:50
  • I'm thinking it will not because i'm not seeing any topics using that. When I set it up with sql works fine but wanted to use access for client to have something light weight – Troy Bryant May 12 '14 at 14:55
  • @GordThompson that was the correct answer http://stackoverflow.com/questions/11197259/does-microsoft-jet-db-work-with-entity-framework what I'm trying to do will not work based on that article – Troy Bryant May 12 '14 at 15:17

2 Answers2

0

Try this bro :

<add name="EmployeeContext" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\Databases\EmployeeDb.mdb" providerName="System.Data.OleDb"/>
Osman M Elsayed
  • 810
  • 5
  • 7
  • This was the error posted after using that provider name "A null was returned after calling the 'get_ProviderFactory' method on a store provider instance of type 'System.Data.OleDb.OleDbConnection'. The store provider might not be functioning correctly." – Troy Bryant May 12 '14 at 15:07
0

I think you forget to add (providerName) Parameter to you connection string. providerName="System.Data.SqlClient"

<add name="EmployeeContext" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\Databases\EmployeeDb.mdb" providerName="System.Data.SqlClient" />

A.Tork
  • 13
  • 3