1

System.DllNotFoundException was unhandled Message=Unable to load DLL 'sqlite3': The specified module could not be found.

I already reference the DLL. I check it on Debug folder and it was there. I also search how to "include" it in the project but they don't specifically explain how to do it.

I'm following this example: http://www.codeproject.com/Articles/22165/Using-SQLite-in-your-C-Application

3 Answers3

1

SQLite doesn't have a full .NET implementation, but available libraries are wrappers of a native one.

This means that not only .NET assembly must be referenced but you need to be sure native library is there too when applicacion is executed.

Summary: output folder will have a .NET assembly and a native assembly (C/C++ one) in order to work properly!

Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206
  • i'm following this example: http://www.codeproject.com/Articles/22165/Using-SQLite-in-your-C-Application for sure they didn't post something that won't work – Joef Clarin Nov 11 '12 at 10:46
  • @JoefClarin Relax and instead of saying that, double-check what I said. I came here to give you a solution. Maybe I'm wrong, but my current understanding of SQLite on .NET is what I said. – Matías Fidemraizer Nov 11 '12 at 10:52
  • @JoefClarin that page is from 2007 and uses a .NET SQLite implementation that hasn't been updated since 2005. Not the best reference material. The current official SQLite wrapper for C# can be found at http://system.data.sqlite.org (maintained by SQLite team) – dtech Nov 11 '12 at 10:53
  • @JoefClarin In addition, if you read MORE the whole article you'll find that definitive sentence: **•SQLite has native language APIs for C/C++, PHP, Perl, Python, Tcl etc. Native API for C# is still not present.**. – Matías Fidemraizer Nov 11 '12 at 10:54
  • @dtech Yeah, and later you find that you want to help him, and he's completely wrong with his comment of "for sure they didn't post something that won't work"............. – Matías Fidemraizer Nov 11 '12 at 10:55
0

The System.Data.SQLite.dll is platform dependent assembly, and you mast add reference to appropriated assembly.

Hamlet Hakobyan
  • 32,965
  • 6
  • 52
  • 68
  • already added it as reference. it won't build if i didn't add the proper reference – Joef Clarin Nov 11 '12 at 10:46
  • The metadatas is same(which needs at compile time) in both x86 and x64 wrappers, therefore the project will build, but runtime exception will occurs when accessing the not proper dll. – Hamlet Hakobyan Nov 11 '12 at 10:55
0

Follow the steps :

1)Add the Dll in debug folder 2)in your code add this

using System.Data.SQLite; 3) Add the reference by going to solution explorer and add it.

4) Check the version in app.config to verify it

Sohail
  • 780
  • 3
  • 14
  • 27