找不到请求的 .Net Framework 数据提供程序 - SQLite [英] Unable to find the requested .Net Framework Data Provider - SQLite

查看:107
本文介绍了找不到请求的 .Net Framework 数据提供程序 - SQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为 sqlite 很简单,但它让我很难过.我只想创建一个应用程序,我可以在其中使用 ado.net 实体数据类连接到 sqlite 数据库.

I thought that sqlite was simple but it is giving me a hard time. I just want to create an application where I can connect to a sqlite database using the ado.net entity data classes.

我在运行 windows xp 的虚拟计算机上测试应用程序时遇到了这个问题.该应用程序在我当前的计算机上运行良好,并且在我部署它们时也可以在我的笔记本电脑上运行.

I am having this problem when testing the application on a virtual computer running windows xp. the application works fine on my current computer and also on my laptop when I deploy them.

这是虚拟计算机上发生的情况:

Here is what happens on the virtual computer :

  • 应用程序能够启动.
  • 应用程序能够使用 System.Data.SQLite 与数据库交互
  • 应用程序无法使用 ADO.NET 实体数据模型连接到数据库

当我尝试连接时,出现以下异常:

when I try to connect I get the following exception:

我知道有很多帖子都在讨论这个问题,其中大多数都说你需要下载 Sqlite 的 .NET 提供程序.

我已经安装了 sqlite-netFx40-setup-bundle-x86-2010-1.0.79.0.exe 并且遇到了同样的问题.我该怎么办?

I have already installed the sqlite-netFx40-setup-bundle-x86-2010-1.0.79.0.exe and I get the same problem. What should I do?

我设法通过添加以下内容建立了连接:

I managed to establish a connection by adding:

<system.data>
 <DbProviderFactories>
  <remove invariant="System.Data.SQLite"/>
  <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
  type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>

到我的 app.config 文件.

to my app.config file.

问题是现在我不能选择数据也不能向数据库插入记录.我现在尝试插入新记录时遇到的异常是:

The problem is that now I cannot select data nor insert records to the database. The exception that I get when I try to insert a new record now is:

在System.Data.SQLite.SQLiteFactory"类型的存储提供程序实例上调用GetService"方法后返回 null.商店提供商可能无法正常运行.

A null was returned after calling the 'GetService' method on a store provider instance of type 'System.Data.SQLite.SQLiteFactory'. The store provider might not be functioning correctly.

推荐答案

不得不补充:

 <system.data>
    <DbProviderFactories>
     <remove invariant="System.Data.SQLite"/>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data   Provider for SQLite"
      type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
     </DbProviderFactories>
  </system.data>

到我的应用程序配置文件.现在看起来像:

to my app config file. and it now looks like:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.0,Profile=Client" />
  </startup>
  <system.data>
     <DbProviderFactories>
        <remove invariant="System.Data.SQLite"/>
        <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
   type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
      </DbProviderFactories>
    </system.data>
</configuration>

在安装 sqlite 的位置我不得不复制

到我的程序 exe 所在的输出目录

这篇关于找不到请求的 .Net Framework 数据提供程序 - SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆