Search code examples
sqlitewindows-phonewindows-phone-8sqlite-net

How do I use an existing sqlite database in my Windows Phone 8 app


I have a database from an existing android app that I need to import into my Windows Phone 8 app. Is the only way to do this to create some huge population script to be ran on the first loading of the app?

I am currently using the new sqlite-net-wp8 by Peter Huene as directed by this blog post. But the examples are all about creating the database, not using an existing one. Any help would be great.


Solution

  • This link shows how to copy an existing sqlite database in Windows 8. The ability to do it on a phone is the same.

    1) Add the sqlite database into your project and set the type to content in its properties.

    2) When your app loads, load the file into a storage file. Then write it back out using the localfolder as the destination.