locked
how to use database in Metro-style apps in javascript?

Answers

All replies

  • You can use indexedDb http://msdn.microsoft.com/en-us/ie/hh440436 which works well in some database scenarios.
    Sunday, October 16, 2011 6:49 PM
  • As Andy suggests, IndexedDb is the current solution for local (client) databases, as I don't know of other client-side database technologies for Javascript.

    For a cloud-hosted database, you can use something like WCF Data Services to communicate with it (see http://www.msdn.com/data for details and the OData site, http://www.odata.org, for JS libraries that do work with Metro style apps). With WCF Data Servces, it's a near-turnkey solution to add an OData service on top of a SQL Server database.

    .Kraig

    Monday, October 17, 2011 1:30 AM
  • Hello,

    I've got a similar problem. I'm developing an app, which has to use a database for backing up data. So I have to use IndexedDB. So far my scenario looks like this:

    I created a html-page on which the user has the opportunity to create new elements dynamically. He clicks on a button in the app bar and new div-TAGs are created via Javascript.

    Of course it is neccecary to save these new tags for later use. Even after an App restart, they have to be still there. Application or Session storage are no solution for me, because later on, there will be more complex data to be saved and I want to code a backup in a single file.

    I followed your link to indexedDB but it didnt work. Perhaps someone has a bit of sample app or some code for me, so that I can study it. I hope someone understands my problem.

    Thank you very much and greetings from Germany

    Dragon

    Sunday, March 11, 2012 7:39 PM
  • Hi Dragon!

    Try this and see if that sample helps you understand this better:

    http://blogs.msdn.com/b/ie/archive/2011/09/27/building-offline-experiences-with-html5-appcache-and-indexeddb.aspx

    -Jeff


    Jeff Sanders (MSFT)

    Monday, March 12, 2012 3:56 PM
    Moderator
  • Hi jpsanders, 

    I have followed that URL, but failed, because indexedDB has had revised, and the latest version from W3 is adopted by IE10.

    My suggestion you can follow the IE10 sample, it work well, because metro app javascript using same engine with IE10. Here is the URL

    http://ietestdrive2.com/OfflineSocialAlbums/ -> view the source and then look at how the database is initialized, and etc. This is work for me.

    Thanks

    Yusak Setiawan

    Tigabelas Technology


    Thursday, March 15, 2012 2:23 PM
  • Thanks for updating the Forum!

    Jeff Sanders (MSFT)

    Thursday, March 15, 2012 2:29 PM
    Moderator