Nelson T Joseph
Nelson T Joseph

Reputation: 2763

Database in WP7

I am creating a windows phone application, which need to store some data in database. Now I am saving these data in some text files in isolatedstorage. I am trying to create one database in my application and failed. Can anyone help me to create a database. I referred the following pages but I could not Understand it clearly. http://msdn.microsoft.com/en-us/library/hh202860(v=vs.92).aspx

http://windowsphonegeek.com/tips/Windows-Phone-Mango-Local-Database-SQL-CE--Creating-the-Database

http://www.silverlightshow.net/items/Windows-Phone-7.1-Local-SQL-Database.aspx

The application downloads some files. My table contains a documentID which is the primary key, the document name,file size and download completed time. How to update the table?

Upvotes: 0

Views: 144

Answers (1)

pan4321
pan4321

Reputation: 891

There are basically 2 ways how you can achieve this.

  1. Either you can create the database and your tables structure earlier and place database file in your project under resources and on first launch of application you can copy that database to isolated storage.

  2. Secondly define your table structures as classes and create the database and tables at first launch of your application.

You can create your Datacontext class deriving from the default Datacontext class so that you can save and get data through LINQ queries.

Hope this helps.

Upvotes: 1

Related Questions