C#使用SQLite出错:无法加载 DLL“SQLite.Interop.dll”,找不到指定的模块
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了C#使用SQLite出错:无法加载 DLL“SQLite.Interop.dll”,找不到指定的模块,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2112字,纯文字阅读大概需要4分钟。
内容图文
![C#使用SQLite出错:无法加载 DLL“SQLite.Interop.dll”,找不到指定的模块](/upload/InfoBanner/zyjiaocheng/520/4e883c0b4c9b4ff182c625781fe369a9.jpg)
引用:https://www.mzwu.com/article.asp?id=3180
在SQLite官方下载了System.Data.SQLite,编写如下测试代码:
复制内容到剪贴板程序代码
using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=F:\my.db;Pooling=true;FailIfMissing=false"))
{
using (SQLiteDataAdapter adapter = new SQLiteDataAdapter("select id,total from table1", conn))
{
DataTable table1 = new DataTable();
adapter.Fill(table1);
MessageBox.Show(table1.Rows[0]["total"].ToString());
}
}
运行出错,在new SQLiteConnection处提示:
引用内容
无法加载 DLL“SQLite.Interop.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。
解决方法
我下载的System.Data.SQLite版本是Precompiled Binaries for 32-bit Windows (.NET Framework 3.5 SP1),这个版本提供了两个zip包:
①.sqlite-netFx35-binary-bundle-Win32-2008-1.0.79.0.zip
引用内容
This binary package features the mixed-mode assembly and contains all the binaries for the x86 version of the System.Data.SQLite 1.0.79.0 (3.7.10) package. The Visual C++ 2008 SP1 runtime for x86 and the .NET Framework 3.5 SP1 are required.
②.sqlite-netFx35-binary-Win32-2008-1.0.79.0.zip
引用内容
This binary package contains all the binaries for the x86 version of the System.Data.SQLite 1.0.79.0 (3.7.10) package. The Visual C++ 2008 SP1 runtime for x86 and the .NET Framework 3.5 SP1 are required.
带bundle的表示动态库是按混合模式编译的,在使用的时候只需要System.Data.SQLite.dll就可以了,而不带bundle的则是将非托管部分和托管部分分别编译,System.Data.SQLite.dll不能独立使用,还需要有SQLite.Interop.dll才能使用。
我用的是不带bundle包中的System.Data.SQLite.dll,解决方法是要么手工复制SQLite.Interop.dll和exe放一块(不能用引用),要么换成引用bundle包中的System.Data.SQLite.dll。
相关链接
[1]·System.Data.SQLite Download Page:http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
C#使用SQLite出错:无法加载 DLL“SQLite.Interop.dll”,找不到指定的模块
标签:down windows ESS connect ted 方法 动态 tostring led
本文系统来源:https://www.cnblogs.com/rickyliu/p/13098868.html
内容总结
以上是互联网集市为您收集整理的C#使用SQLite出错:无法加载 DLL“SQLite.Interop.dll”,找不到指定的模块全部内容,希望文章能够帮你解决C#使用SQLite出错:无法加载 DLL“SQLite.Interop.dll”,找不到指定的模块所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。