Proplem using SQLiteConnection in winrt using C #?

I am new to WinRT development. I try to use sqlite in C #, however, when I try to connect to a local database file as follows:

string path = @"D:\product.s3db"; string constr = "Data Source=" + path + "; Version=3; PRAGMA temp_store_directory=" + Windows.Storage.ApplicationData.Current.TemporaryFolder.Path; SQLiteConnection con = new SQLiteConnection(constr); 

it returns an exception "Could not open the database file", so what is wrong here?

+4
source share
1 answer

I think the reason is that WinRT applications are sandboxed and have limited access to the file system. Try to save the database in a folder accessible for your application.
Check out Windows 8: the right way to read and write files in WinRT , this may help.

+3
source

Source: https://habr.com/ru/post/1447240/


All Articles