entity-framework - 具有Microsoft Access的 Entity Framework

标签 entity-framework ms-access connection-string

我使用.accdb文件。我创建了类(class)

using System.Data.Entity;

    class MSADbContext:DbContext
    {
        public DbSet<Product> Products { get; set; }
    }

并添加connectionString
<add name="MSADbContext" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\SportsStore.accdb" providerName="System.Data.OleDb"/>

在第一次查询数据库后,我得到ProviderIncompatibleException:“在存储库typeOf“System.Data.OleDb.OleDbConnection”中调用“get_ProviderFactory”返回null“

最佳答案

您的连接字符串将用于.mdb(Access 2003-)文件。检查连接strings here

您需要ACE OLEDB提供程序。标准安全性:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;
Persist Security Info=False;

但是,请先阅读this thread:

Entity Framework does not support OLEDB connections, so your connection string will not work. It is practically impossible to get Entity Framework to collaborate with MS Access.



实际上是不可能的非常引人注目。

关于entity-framework - 具有Microsoft Access的 Entity Framework ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18430415/

相关文章:

c# - "Syntax error in insert into statement"插入图片到Access表时

ms-access - 如何通过 VBA 设置 Access Tab 控件的页面名称

asp.net - 如何在 SQL Server Express 2008 中创建新数据库并允许连接?

c# - 迁移 "our target project ' xxx' 与您的迁移程序集 'xxx' 不匹配“使用 aspnet Core 1.0 RC2 -

entity-framework - Entity Framework 迁移停止检测POCO更新

ms-access - 导出为带有列标题的文本

database - Sitecore 6 - 无法删除内容交付服务器上的主数据库

entity-framework - 通过 nuget 进行引用 dll 中的 EF 代码迁移

c# - 在实体及其代理类型之间进行转换

mysql - 在 mysql 中,对于四个连接字符串,最小池大小是多少?