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

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

问题描述

我认为sqlite很简单,但是给我一个困难的时刻。我只想创建一个应用程序,我可以使用ado.net实体数据类连接到一个sqlite数据库。



我在一个测试应用程序时遇到这个问题虚拟电脑运行Windows XP。该应用程序在我当前的计算机上以及在部署它们时在我的笔记本电脑上工作正常。



以下是虚拟机上发生的情况:




  • 应用程序可以启动。

  • 应用程序能够使用System.Data.SQLite与数据库进行交互

  • 应用程序无法连接到数据库使用ADO.NET实体数据模型



当我尝试连接我得到以下异常: / p>





我知道有很多帖子谈论这个,大多数人说你需要下载 .NET提供者为Sqlite。



我已经安装了sqlite-netFx40-setup-bundle-x86-2010-1.0.79.0.ex我和我也遇到同样的问题。我该怎么办?






编辑



通过添加:

 < system.data>建立连接。 
< DbProviderFactories>
< remove invariant =System.Data.SQLite/>
< add name =SQLite数据提供者invariant =System.Data.SQLitedescription =。SQLite的Net Framework数据提供者
type =System.Data.SQLite.SQLiteFactory,System .Data.SQLite/>
< / DbProviderFactories>



到我的app.config文件。



问题是现在我无法选择数据,也不能在数据库中插入记录。当我尝试插入新记录时,我得到的例外情况是:



在对'类型'的商店提供者实例调用'GetService' System.Data.SQLite.SQLiteFactory。商店提供商可能无法正常运行。



解决方案

不得不添加:

 < system.data> 
< DbProviderFactories>
< remove invariant =System.Data.SQLite/>
< add name =SQLite数据提供者invariant =System.Data.SQLitedescription =。SQLite的Net Framework数据提供者
type =System.Data.SQLite.SQLiteFactory,System .Data.SQLite/>
< / DbProviderFactories>
< /system.data>

到我的应用配置文件。它现在看起来像:

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

< startup useLegacyV2RuntimeActivationPolicy =true>
< supportedRuntime version =v4.0.30319sku =。NETFramework,Version = v4.0,Profile = Client/>
< / startup>
< system.data>
< DbProviderFactories>
< remove invariant =System.Data.SQLite/>
< add name =SQLite数据提供者invariant =System.Data.SQLitedescription =。SQLite的Net Framework数据提供者
type =System.Data.SQLite.SQLiteFactory,System .Data.SQLite/>
< / DbProviderFactories>
< /system.data>
< / configuration>



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





到我的程序exe发生在我的输出目录


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.

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 :

  • The application is able to launch.
  • The application is able to interact with the database using System.Data.SQLite
  • The application is not able to connect to the database using The ADO.NET Entity data models

when I try to connect I get the following exception:

I know there are a lot of post that talk about this and most of them say that you need to download the .NET provider for Sqlite.

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?


Edit

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>

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:

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.

解决方案

had to add:

 <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>

In the location where sqlite was installed I had to copy

to my output directory where my program exe happens to by

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

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