Over a million developers have joined DZone.

Windows Phone Mango database support: actually pretty good

· Mobile Zone

Learn how to Deliver Better Mobile Apps Faster with Continuous Quality by managing the complexities of testing multiple devices and scenarios with this whitepaper from Perfecto Mobile.

Back in June, WindowsPhoneGeek wrote a popular post walking Windows 7.1 developers through creating a simple Local Database application (for storing strings).

A few months later, on September 23rd, Microsoft published their own step-by-step HowTo

(for a to-do list). (The rest of Microsoft's Local Database documentation is probably worth reading/bookmarking too.)

WindowsPhoneGeek's guide is a little easier to follow, because it doesn't explain each step very much. Microsoft's guide explains its code at a fairly low level, so it demands a bit of concentration (like a lot of MSDN documentation).

Now Mark Arteaga has written his own Mango database HowTo, falling somewhere in between those two: clear and a little chatty, and emphasizing the Mango-specific aspects of the code (with spotlighting 'here's something to notice!' comments sprinkled throughout).

Here's how Mark puts his guide in the context of other documentation:

Couple things to cover:

  • Connection strings: to get all the details on Connection String and Local Database on Windows Phone see MSDN.  But one key thing to notice is isostore which is unique to Windows Phone
    • isostore: this essentially means your database was created in code, is read/write and located in isolated storage for your app
    • appdata: this essentially means your database was included in your application, is in the installation folder and is read only.  You can copy this file into Isolated Storage to make it read/write.
  • Initialize – we call this so we can check to see if the database exists and if it does not create it. 
  • Updating Database – I don’t go through this as it’s another post on it’s own.  Read this on MSDN on updating a local database on Windows Phone, it’s a must read!

This is a solid introduction to Windows Phone 7.5's database support. Check it out here.

Do you know Why Apps Succeed? Perfecto Mobile analyzed over 1,000 responses to their Digial Quality Strategies survey and aim to answer the question, "Why do apps succeed?" in this exclusive report.


The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}