System.ArgumentException:“The specified invariant name ‘System.Data.SQLite‘ wasn‘t found in the list

简介: System.ArgumentException:“The specified invariant name ‘System.Data.SQLite‘ wasn‘t found in the list

System.ArgumentException:“The specified invariant name 'System.Data.SQLite' wasn't found in the list of registered .NET Data Providers.”

var connectionString = "Data Source=C:\\Users\\Administrator\\AppData\\Local\\Hunter\\hunter.sqlite;";
var db = new Database(connectionString, "System.Data.SQLite");

引SQLite报错

System.ArgumentException:“The specified invariant name 'System.Data.SQLite' wasn't found in the list of registered .NET Data Providers.”

这个文件是NetCore版本后出现的我用的是NET6。这个错误的解决是添加数据库的Providers代码:

DbProviderFactories.RegisterFactory("System.Data.SQLite", SQLiteFactory.Instance);

直接引用会报错需要引入System.Data.SQLite核心类在Nuget中引用效果如下:

OK引命名空间引入完毕后完成。

目录
相关文章
|
XML 关系型数据库 MySQL
【MySQL异常】ExecutorException: Error getting generated key or setting result to parameter object
【MySQL异常】ExecutorException: Error getting generated key or setting result to parameter object
524 0
|
10月前
|
API Android开发 开发者
failed to set system property error code: 0x18
failed to set system property error code: 0x18
450 1
|
10月前
|
Java
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
245 1
DevTools failed to load source map: Could not load content for…System error: net::ERR_FILE_NOT_FOUN
DevTools failed to load source map: Could not load content for…System error: net::ERR_FILE_NOT_FOUN
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
|
存储 C# 数据库
System.Data.SQLite 中GUID的处理
原文:System.Data.SQLite 中GUID的处理 项目中正好用到System.Data.SQLite,在手持上使用这个数据库,因为要做数据同步,所以表中的主键都是Guid的数据类型。
1082 0
|
JavaScript 前端开发
|
Oracle 关系型数据库 C++
|
开发工具 Perl