0
votes

I am trying to include SQLite database in my Windows 8 Store App (HTML/JS). I was following these tutorials:

http://www.youtube.com/watch?feature=player_embedded&v=luV6no8ti6M http://timheuer.com/blog/archive/2012/08/07/updated-how-to-using-sqlite-from-windows-store-apps.aspx

At one point I added following code:

var dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "people.db");
using (var db = new SQLite.SQLiteConnection(dbpath))
{
    ...
}

After deploying application I get following error:

Could not open database file: C:\Users\...\people.db (CannotOpen)

I looked up this path and file people.db was created, but apparently failed to open. What might be the reason for this?

I have also downloaded source code for this tutorial:

http://www.dzone.com/articles/getting-started-sqlite-windows

and got exact same exception - might there be something wrong with my computer configuration?

1
While following the last bit that you linked, is the db a part of your project, set to "Content" and "Copy Always"? Or are you trying to create it fresh? - Nate Diamond
Yes, I did change properties of included to the project db to "Content" and "Copy Always". - Jarek Mazur
Is the file possibly Readonly? - Nate Diamond

1 Answers

0
votes

Actually your database file is in program files/program files(X86) after deploying your application where you have no rights by default to create, open & update existing file.

you cannot change this rights. As we are only allow to create folder inside the program files/program files(X86) directory.

If you change the directory (Except program files/program files(X86)) while installing then this may work very well.

refer

http://www.dzone.com/articles/getting-started-sqlite-windows