Abhay Kumar
Abhay Kumar

Reputation: 1618

Windows phone 7- Loading an existing Database into isolated storage

How do I load an existing database with lots of data in it, to isolated storage. I have read little of how to use database in phone 7 but they don't load any predefined data. Instead they create a database if it is running for the first time later use the same.

Upvotes: 2

Views: 1414

Answers (1)

Rich Hopkins
Rich Hopkins

Reputation: 1891

It is possible to add a database to your project, but it can only be used in read-only mode. If you want to read/write to it, you have to add code that will copy the data to a separate database after install.

http://visualstudiomagazine.com/articles/2011/10/01/linq-to-sql-on-windows-phone-75.aspx From that article:

Using an Existing Database It's possible to ship an existing database with your application by adding it to your project and setting the Build Action to Content. This will deploy the database file with your application onto the phone, but it will be placed in the same folder as all other static content for your application. Your application can only read from this folder, which means you either have to open the database in read-only mode, or copy the database across into Isolated Storage before accessing it. The following is an example connection string for a database that's been packaged with the application:

Upvotes: 1

Related Questions