This has worked out really well for me. One trick that made all the difference was using the method described in the below thread. I agree with others that the documentation could be better but because how well sqlite performs for my app, I am still giving it 5 stars.
Appalling documentation For those wondering what the hell is this file, installing it is equivalent to getting it from "Extensions in updates" outlined in this video. You also need to restart visual studio for changes to take effect; https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Using-SQLite-in-Windows-Store-Apps
An OK database (I mean -- how interesting is a database? It's some tables, and I can do SQL with them). However, they've spoiled all of the work they did (making a nice VSIX package, making it work with runtime, getting into this site, etc) by the appalling documentation.
Seriously. I've been looking and looking at the sqlite.org site (the "get more information!" link), and there's seemingly no windows documentation at all. What I expected was at least a "five minute into" that would explain little things like: what is a VSIX file? where do I find the thing it's installed? How do I use it from C#?.
At this point, even though I've used Sqlite in the past, and I've set up my project to use an existing Sqlite database file which I've already created and filled with data, I'm seriously wondering if creating my own binary formated file would be faster to create than trying to figure out how to use this package. And that's just plain sad.
A few hours of work creating a how to, and making that how-to findable, would turn this package into something I could recommend.
The SqliteException "CannotOpen" is thrown if I want to attach second database and if the path contains special characters (e.g. 'š'). Windows store app local folder contains username that is why special characters can occur very often in a path of database file.
I suppose the problem is based on different encoding (UTF-8 in SQLite, UTF-16 in .Net) but I haven't managed to resolve it. Sqlite contains methods for opening database in UTF 16 (sqlite3_open16). But there is no such a method for SQL statements.
string dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "sqlite1.db");
string dbPath2 = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "sqlite2.db");
using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLitePlatformWinRT(), dbPath))
var cmd = conn.CreateCommand("ATTACH '" + dbPath2 + "' AS second;");
cmd.ExecuteNonQuery(); // -> it throws "CannotOpen" exception if dbPath2 contains special characters
I tried to compile sqlite with the SEE extension, described here
But the docu seems to be outdated, as it is for 8.0 not 8.1 and when I try it, I get errors like
Microsoft (R) Program Maintenance Utility Version 11.00.60610.1
Copyright (C) Microsoft Corporation. All rights reserved.
link.exe /DEBUG /NOLOGO /APPCONTAINER /DLL /DEF:sqlite3.def /OUT:sqlite3.dll sqlite3.lo
Creating library sqlite3.lib and object sqlite3.exp
sqlite3.lo : error LNK2019: unresolved external symbol _sqlite3_key_v2 referenced in function _openDatabase
sqlite3.lo : error LNK2019: unresolved external symbol _sqlite3_rekey_v2 referenced in function _sqlite3Pragma
sqlite3.lo : error LNK2019: unresolved external symbol _sqlite3_activate_see referenced in function _sqlite3Pragma
sqlite3.lo : error LNK2019: unresolved external symbol _sqlite3CodecAttach referenced in function _attachFunc
sqlite3.lo : error LNK2019: unresolved external symbol _sqlite3CodecGetKey referenced in function _attachFunc
sqlite3.dll : fatal error LNK1120: 5 unresolved externals
could anybody help?
I am using SQLite WInRT 3.10.1 in my Windows Store App.
A timer keeps updating & reading the sqlite using SQLiteAsyncConnection.
Also, upon clicking a button & successful server communication, sqlite is updated using SQLiteConnection.
So, SQLite is updated/read in parallel and also with 2 different SQLiteAsyncConnection & SQLiteConnection.
Under this scenario, the following System.AccessViolationException is thrown:
Exception Info: System.AccessViolationException
at SQLite.SQLiteConnection.Execute(System.String, System.Object)
at System.Threading.Tasks.Task`1[[System.Int32, mscorlib, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
How to resolve this ?
Grateful Thanks in Advance..
Hi! My application and sqlite runs perfectly when i debug it using visual studio however after publishing the app on store my application is not working due to sqlite failure. SQLITE is not working after deployment. Please help.
You can download it from the official site https://www.sqlite.org/download.html. They have a naming convention, so based on the version you want your link should be: https://www.sqlite.org/2014/sqlite-winrt81-3080500.vsix
I am working on a windows phone 8.1 project with SQLite PCL. My Database is working perfectly.
But I am having trouble displaying it physically.
Can anyone of you please guide me with proper steps.