Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
连接到win IOT上的sqlite数据库_Sqlite_Raspberry Pi_Iot_Windows 10 Iot Core - Fatal编程技术网

连接到win IOT上的sqlite数据库

连接到win IOT上的sqlite数据库,sqlite,raspberry-pi,iot,windows-10-iot-core,Sqlite,Raspberry Pi,Iot,Windows 10 Iot Core,我在尝试连接到raspberry pi 3上的sqllite数据库时遇到错误{SQLite.Net.SQLiteException:无法打开数据库文件:C:\Data\Users\DefaultAccount\Documents\Storage.db(CannotOpen),WIN IOT是操作系统。我正在使用SQLite的SQLite.Net-PCL版本3.1.1实现 var documentsPath = System.Environment.GetFolderPath(System.Env

我在尝试连接到raspberry pi 3上的sqllite数据库时遇到错误{SQLite.Net.SQLiteException:无法打开数据库文件:C:\Data\Users\DefaultAccount\Documents\Storage.db(CannotOpen),WIN IOT是操作系统。我正在使用SQLite的SQLite.Net-PCL版本3.1.1实现

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();
        }

我想您使用的是UWP应用程序。在Windows IoT Core上,您可以使用它使UWP应用程序可以访问此路径“C:\Data\Users\DefaultAccount\Documents”

FolderPermissions C:\Data\Users\DefaultAccount\Documents -e
因为您没有收到“拒绝访问”错误,所以我想您已经在Package.appxmanifest中添加了以下功能

<uap:Capability Name="documentsLibrary" />

然后你的代码就可以工作了。(我在Raspberry Pi 3上测试了Windows IoT核心版本10.0.17763.107)


设置文件夹“C:\Data\Users\DefaultAccount\Documents”的权限解决了这个问题。非常感谢!我添加了line;md.CreateTable();在md=新行并收到错误后;SQLite.Net.SQLiteException:磁盘I/O错误。我已经检查过,storage.db和storage.db-journal都有读写权限。我发现有人建议为数据库设置标志QLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex,但我不知道该怎么做那个?嗨@Dave,看来“无法打开”的问题已经解决了,对吗?如果是真的,你可以参考,这样我们就可以完成这个问题。我看到你发了一个帖子,所以我们将继续。是的,这个问题已经结束。再次感谢。