C# 将SQLite数据库保存到文档文件夹win Windows应用商店应用

C# 将SQLite数据库保存到文档文件夹win Windows应用商店应用,c#,sqlite,windows-runtime,windows-store-apps,C#,Sqlite,Windows Runtime,Windows Store Apps,我一直在使用XAML和C#编写一个Windows8应用商店应用程序,目标设备是WindowsSurface平板电脑 在我的应用程序中,我使用SQLite数据库 要创建/加载数据库,我使用以下代码: DBPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "MyDatabase.sqlite"); 但是,我希望将数据库存储在Documents文件夹中,因此我尝试使用以下代码行替换上面的代码行:

我一直在使用XAML和C#编写一个Windows8应用商店应用程序,目标设备是WindowsSurface平板电脑

在我的应用程序中,我使用SQLite数据库

要创建/加载数据库,我使用以下代码:

DBPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "MyDatabase.sqlite");
但是,我希望将数据库存储在Documents文件夹中,因此我尝试使用以下代码行替换上面的代码行:

DBPath = Path.Combine(Windows.Storage.KnownFolders.DocumentsLibrary.Path, "MyDatabase.sqlite");
当我尝试此操作时,会出现以下错误:

WinRT information: Access to the specified location (DocumentsLibrary) requires a capability to be declared in the manifest.
Could not open database file: MyDatabase.sqlite (CannotOpen)
因此,我打开Package.appxmanifest并在“功能”下选择Documents Library,并在“声明”选项卡下添加了一个文件类型关联。然后在“属性”下输入 名称框中的sqlite和文件类型框中的.sqlite。我没有在Package.appxmanifest屏幕上输入其他信息

现在,当我运行应用程序时,我收到以下错误:

WinRT information: Access to the specified location (DocumentsLibrary) requires a capability to be declared in the manifest.
Could not open database file: MyDatabase.sqlite (CannotOpen)
当我检查Windows.Storage.KnownFolders.DocumentsLibrary.Path时,它等于“”。我希望这里有完整的位置路径

有人能帮忙吗?有人把SQLite数据库保存到documents文件夹吗


提前感谢。

KnownFolders.DocumentsLibrary没有路径,因为它是一个虚拟位置。请查看以了解更多详细信息。这可能导致无法在那里打开SQLite数据库,至少使用库中可用的API是如此

此外,在Windows应用商店应用程序中使用“访问文档库”之前,请记住,要将具有此功能的应用发布到应用商店中,您必须执行以下操作。对于个人账户,此类申请将被拒绝