I'm getting error {SQLite.Net.SQLiteException: Could not open database file: C:\Data\Users\DefaultAccount\Documents\Storage.db (CannotOpen) when trying to connect to sqllite database on a raspberry pi 3, with WIN IOT is the OS. I'm using the SQLite.Net-PCL ver 3.1.1 implementation of SQLite.
var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var fileName2 = "Storage.db";
var path2 = Path.Combine(documentsPath, fileName2);
try
{
using (var connection = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path2))
{
}
}
catch (Exception ex)
{
string m_er = ex.ToString();
}
I suppose you use UWP application. On Windows IoT Core you can use FolderPermissions tool to make this path "C:\Data\Users\DefaultAccount\Documents" accessible to a UWP app.
FolderPermissions C:\Data\Users\DefaultAccount\Documents -e
Since you don't receive "access denied" error so I suppose you have already added the following capability in the Package.appxmanifest.
<uap:Capability Name="documentsLibrary" />
Then your code will work. (I test on Raspberry Pi 3 with Windows IoT Core version 10.0.17763.107)