C# 找不到请求的.Net Framework数据提供程序-SQLite
我认为sqlite很简单,但它给我带来了困难。我只想创建一个应用程序,在这个应用程序中,我可以使用ado.net实体数据类连接到sqlite数据库 在运行windows xp的虚拟计算机上测试应用程序时,我遇到了这个问题。该应用程序在我当前的计算机上运行良好,在我部署它们时也可以在我的笔记本电脑上运行 以下是虚拟计算机上发生的情况:C# 找不到请求的.Net Framework数据提供程序-SQLite,c#,sqlite,deployment,ado.net,C#,Sqlite,Deployment,Ado.net,我认为sqlite很简单,但它给我带来了困难。我只想创建一个应用程序,在这个应用程序中,我可以使用ado.net实体数据类连接到sqlite数据库 在运行windows xp的虚拟计算机上测试应用程序时,我遇到了这个问题。该应用程序在我当前的计算机上运行良好,在我部署它们时也可以在我的笔记本电脑上运行 以下是虚拟计算机上发生的情况: 应用程序能够启动 应用程序能够使用System.Data.SQLite与数据库交互 应用程序无法使用ADO.NET实体数据模型连接到数据库 当我尝试连接时,出现
- 应用程序能够启动
- 应用程序能够使用System.Data.SQLite与数据库交互
- 应用程序无法使用ADO.NET实体数据模型连接到数据库
编辑 我通过添加以下内容成功建立了连接:
<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文件
问题是,现在我无法选择数据,也无法将记录插入数据库。我现在尝试插入新记录时遇到的例外情况是:
对类型为“System.Data.SQLite.SQLiteFactory”的存储提供程序实例调用“GetService”方法后返回null。存储提供程序可能无法正常运行
必须添加:
<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>
到我的应用程序配置文件。现在看来:
<?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所在的输出目录