I’m new to WinRT development. I’m trying to use sqlite in c#, however when I try to connect to a local database file like this:
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 database file”, so what is wrong here?
I think reason is that WinRT applications are sand-boxed and have limited access to the file system. Please try to store database in folder that is available for your application.
Check the Windows 8: The Right Way to Read & Write Files in WinRT article, it may help.