开发者

Need to load a DLL to use SQLiteWrapper in C#

开发者 https://www.devze.com 2023-01-11 17:38 出处:网络
I am trying to access my databases in C#. The databases are SQLite and I am trying to access it like so:

I am trying to access my databases in C#. The databases are SQLite and I am trying to access it like so:

string CurrentDatabase = Path.FullName + "\\stock.sqlite";

SQLiteBase db = new SQLiteBase(CurrentDatabase);

I am using a SQLite DLL I found here to access the database:

http://www.codeproject.com/KB/database/cs_sqlitewrapper.aspx

But I get this error:

Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I think I know what's wrong, I dont have the sqlite3 DLL anywhere on my system... but I would like this application to be portable so I cannot expect users to already have this DLL installed. I have read about loading a DLL from another application which has already got this DLL somewhere, Firefox is a good example. It's installed on 开发者_JAVA百科all of my companies machines and if I could some how load the sqlite3 DLL from the Firefox Program Files directory into my application it should work perfectly, no? If that's really the solution I'll need help actually loading the DLL, as I don't know how to do that.

Thanks.


Copy the sqlite3.dll into the same directory where your DLL wrapper is and supply that as part of the distributable of your application when done, in that way there'll be no nonsense associated with dll versioning mismatches.. you can download the latest version from http://sqlite.org


I recommend using System.Data.SQLite, which is an ADO.NET provider for SQLite. Then you can program with the ADO.NET API. Its DLL includes sqlite3.dll, so you don't have to include it.

0

精彩评论

暂无评论...
验证码 换一张
取 消