3

I used Visual Studio 2015 with SP2. I try created Windows Universal app with sqlite. I added SQLite for Unversal Windows Platforms and SQLite.Net-PCl. It is my simple code

var conn = new SQLiteConnection(
            new SQLitePlatformWinRT(),
            Path.Combine(ApplicationData.Current.LocalFolder.Path,  "Storage.sqlite"));

It is working for desktop. But it is not work for mobile(in device and emulator). I get this exception System.DllNotFoundException:

  HResult=-2146233052
  Message=Unable to load DLL 'sqlite3': The specified module could not be  found. (Exception from HRESULT: 0x8007007E)
Source=SQLite.Net.Platform.WinRT
TypeName=""
StackTrace:
   at SQLite.Net.Platform.WinRT.SQLite3.SetDirectory(UInt32 directoryType, String directoryPath)
   at SQLite.Net.Platform.WinRT.SQLiteApiWinRT..ctor()
   at SQLite.Net.Platform.WinRT.SQLitePlatformWinRT..ctor()
   at AppDbTest.MainPage.DbConnection()
   at AppDbTest.MainPage..ctor()
   at AppDbTest.AppDbTest_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_MainPage()
   at AppDbTest.AppDbTest_XamlTypeInfo.XamlUserType.ActivateInstance()

I try this method. I reinstall SQLite for Unversal Windows Platforms extension and SQLite.Net-PCl. I created clear project. But it does not work for me.

halfer
  • 19,824
  • 17
  • 99
  • 186
FetFrumos
  • 5,388
  • 8
  • 60
  • 98
  • Did you try updating your nuget packages for new sqlite version? – Jerin Apr 02 '16 at 04:37
  • I use SQLite.Net-PCL 3.1.1 and SQLite.Net.Async-PCL 3.1.1. It is last version. – FetFrumos Apr 02 '16 at 06:38
  • For SQLite.Net.Async-PCL I am using 3.0.5 as 3.1.1 popped up some bug, in my project other than that my project works fine on all three desktop, mobile and emulator. Is it occurring in only current project or in every other project? – Jerin Apr 02 '16 at 06:47
  • This problem in the first working project. I created clear windows universal project - but I have this problem – FetFrumos Apr 02 '16 at 06:54
  • Since the problem might be in your current working environment or else some reference you have made could you share a sample app with the same error. – Jerin Apr 02 '16 at 07:19
  • I is my test project with this problem - https://github.com/FetFrumos/AppDbTest – FetFrumos Apr 02 '16 at 07:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/108020/discussion-between-jerin-and-fetfrumos). – Jerin Apr 02 '16 at 08:04

3 Answers3

10

I add a reference to Visual C++ 2015 Runtime for Universal Windows Platform Apps. It is work for me. I used SQLite for Universal Windows Platform.

FetFrumos
  • 5,388
  • 8
  • 60
  • 98
5

Make sure that you current add 2 references

  1. Sqlite for Universal Windows Platfrom
  2. Visual C++ Runtime 2015 for Unversal Windows Platfrom

It's still worked!

Nguyên Phạm
  • 441
  • 5
  • 2
  • This should be the expected answer. Incase you can't see "Sqlite for Universal Windows Platform" option.. then install the VSIX from Sqlite.org – Mohib Sheth Sep 09 '16 at 05:49
0

Solved in chat.
OP solved it using Nuget console : Install-Package SQLite.WinRT.UAP and used "add link" ->"Extensions"->SQLite for Windows Runtime
Suggestion
Cool but would suggest you to use Extension SQLite for Universal App Platform as it encases most of device family and SQLite.WinRT.UAP is not needed. As in current repo I removed references for Winrt and using these extensions its working fine. Just check if the Sqlite vsix package installed is the correct one on your system.

Jerin
  • 3,657
  • 3
  • 20
  • 45
  • I am sorry, but it is not work for me :(. "SQLite for Universal App Platform" it is old name "SQLite for Universal Windows Platform"? – FetFrumos Apr 02 '16 at 20:57
  • oh yeah you are right as from this [tutorial](http://igrali.com/2015/05/01/using-sqlite-in-windows-10-universal-apps/) you can see the earlier was `SQLite for Universal App Platform` (even I have this installed) which they have changed to `SQLite for Universal Windows Platform` but for it to not work in mobile emulator means its an error from SQLite end. Now thats why WinRT sqlite worked while The UWP didnt. – Jerin Apr 03 '16 at 07:17