使用C#的sqllite数据库 [英] sqllite database with c#

查看:60
本文介绍了使用C#的sqllite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我试图在C#中使用具有dll System.Data.Sqllite版本1.0.82的sqllite创建数据库的小型测试应用程序,并且该程序可以在我的64位计算机上完美运行.现在,我尝试在主应用程序中使用相同的sqlLite数据库,该数据库不断给我错误消息

我写的代码

Hello All,
I tried to create a small testing application in C# using database as sqllite having dll System.Data.Sqllite version 1.0.82 and its running perfectly on my 64 bit machine. Now i tried to use the same sqlLite database in my main application it continuously giving me error message

code that i written

SQLiteConnection objConn = null;
           SQLiteDataAdapter oleda = new SQLiteDataAdapter();
           SQLiteCommand cmd = new SQLiteCommand();


string filename = DefaultLogFilePath + "\\AppData\\LocalLow\\Dictionary\\Dictionary.sqlite";
               const string sql = "select * from DictionaryFile;";
               objConn = new SQLiteConnection("Data Source=" + filename + ";Version=3;");
               objConn.Open();
               oleda = new SQLiteDataAdapter(sql, objConn);

               oleda.Fill(dt);









Could not load file or assembly ''System.Data.SQLite, Version=1.0.82.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139'' or one of its dependencies. The system cannot find the file specified.



有人可以建议我如何解决此问题.





谢谢
Anand



Can anybody suggest me how to solve this issue.





Thanks
Anand

推荐答案

我遇到了同样的问题.这是因为sqlite分析是针对特定平台而不是anycpu编译的. Tus,您必须为该平台使用正确的dll.如果您尚未为该依赖性设置强名称验证,只需替换 dll [^ ].您可以像这样通过依赖关系遍历器检查依赖关系问题: Depends4Net-第1部分 [ ^ ].
I encountered the same issue. It is because the sqlite assamblies are compiled for specific platforms, not anycpu. Tus you have to use the proper dll for that platform. If you have not set strong name verification for that dependency, simply replace the dll[^]. You can check the dependency problems with a dependency walker like this: Depends4Net - Part 1[^].


这篇关于使用C#的sqllite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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