[UWP]在可移动设备上创建SQLite数据库时出现问题 [英] [UWP]Problem creating SQLite database on a removabledevice
问题描述
在手机上的sd-card等可移动设备上创建sqlite-db的正确方法是什么?
What is the right way to create a sqlite-db on a removabledevice like a sd-card on a phone?
我对sd-card有完全访问权限,但当我用
I have full access on the sd-card, but when I create a db with
创建数据库时,var r = SQLite3.Open(databasePathAsBytes,out handle,(int)openFlags,IntPtr.Zero);
var r = SQLite3.Open(databasePathAsBytes, out handle, (int)openFlags, IntPtr.Zero);
返回SQLite3.Result.CannotOpen并且
SQLite3.Result.CannotOpen is returned and
SQLite3.ExtendedErrCode(句柄)返回14.
SQLite3.ExtendedErrCode(handle) returns 14.
这不是当我使用ApplicationData.Current.LocalFolder时,这很正常。
This doesnt happen, when I'm using ApplicationData.Current.LocalFolder, this works fine.
我正在使用SQLite用于通用Windows平台3.15.0.0
I'm using SQLite for Universal Windows Platform 3.15.0.0
推荐答案
Tom_QV,
Hi Tom_QV,
Rob回复了一个类似的问题在
here 。
Rob has replied a similar question in here.
他说" 因为SQLite直接打开数据库文件而不是通过文件代理,它只能看到应用程序中的数据库安装d应用程序数据(应用程序具有直接读取和读取/写入
的文件权限的目录)。
更改此项将需要更新SQLite以使用来自文件代理对象(StorageFile和StorageFolder)的流来访问具有通过功能,选择器等授予权限的位置。 "。
所以你可以将这个db文件从SD卡复制到本地文件夹。
So you could copy this db file from SD card to local folder.
另外,请阅读粘贴帖子,尤其是
指南发布:主题行标签和
Windows 10 SDK和工具的已知问题
In addition, please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools
最诚挚的问候,
X. avier Eoro
Xavier Eoro
这篇关于[UWP]在可移动设备上创建SQLite数据库时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!