Windows 10 removableStorage SQLite database -
i trying create external sqlite database, follow , tested text files in removable storage , works. try create database in removable storage:
public static async task<string> createdatabase(string name) { var folder = await findremovablestorage(); if (folder != null) { var file = await folder.createfileasync(name, creationcollisionoption.replaceexisting); if(file!=null) { var ret = $"{folder.name}{file.name}"; return ret; } } return null; } public async void thirdcase() { var path =await dataloggerservice.createdatabase("db.dat"); var connection = new sqlite.net.sqliteconnection(new sqliteplatformwinrt(), path); //cannot open }
i testing on desktop, , returns cannotopen. has created database out typical local folder?
more details of did here: datalogger
when finish want implement in raspberry pi, theorically same code windows iot or there change in sqliteplatformwinrt?
edition: more analisys:
i have tested database typical, working charm:
path.combine(windows.storage.applicationdata.current.localfolder.path, "db.dat");
i wanted create database in external storage, need add following steps:
1.- add capability use removablestorage. 2.- add file type association in order have rights manage kind of files
(the details here: http://expediteapps.com/blog/data-logger-with-windows-10-iot-in-progress/)
so change path removable storage path “e:\db.dat” , tells cannotopen.
the sqlite library pcl arrives here:
sqliteapiwinrt.cs
public result open(byte[] filename, out idbhandle db, int flags, intptr zvfs) { sqlite3databasehandle internaldbhandle; var ret = (result)sqlite3.open(filename, out internaldbhandle, flags, zvfs); db = new dbhandle(internaldbhandle); return ret; }
where open is
[dllimport("sqlite3", entrypoint = "sqlite3_open_v2", callingconvention = callingconvention.cdecl)]
public static extern result open(byte[] filename, out intptr db, int flags, intptr zvfs);
where using:
sqlite.uap.2015, version=3.8.10
more aditions:
i have tested library https://www.nuget.org/packages/sqliteportable/ , finish in same error, internal.
and here road ends, help?
since asked raspberrypi 3 windows 10 iot sqlite implementation, here steps followed make work: (visual studio 2015 community)
- download: .vsix package universal windows platform sqlite page
- install package download folder
- in visual studio go tools->nuget package manager->package manager console , type in:
install-package sqlite.net-pcl
- add required references (right mouse button -> add reference -> universal windows -> extensions)
here choose following:
- microsoft visual c++ 2013 runtime package windows universal
- sqlite universal windows platform
- visual c++ 2015 runtime universal windows platform apps
- windows iot extensions uwp (since using rpi 3 gpio pins)
basically followed chrisbriggsy steps , had add more resources cause sqlite didn't work
Comments
Post a Comment