加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

实体框架 – 使用Microsoft Access的实体框架

发布时间:2020-12-14 01:45:46 所属栏目:Windows 来源:网络整理
导读:我使用.accdb文件.我创造了课程 using System.Data.Entity; class MSADbContext:DbContext { public DbSetProduct Products { get; set; } } 并添加connectionString add name="MSADbContext" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Sour
我使用.accdb文件.我创造了课程
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"/>

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

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

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

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:myFoldermyAccess2007file.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.

几乎不可能是非常引人注目的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读