How do I interact with SQL in a Windows Store App

c#, windows-8, windows-runtime, windows-store-apps

Solution

You can accomplish it with C# or JavaScript and you'd do it pretty much the same way, via services. Windows Store (C#/VB) applications don't have the same capabilities as desktop apps do to access databases via interfaces like ODBC, JDBC, SQL Native Client, etc., so you won't be connecting your Win RT app with SQL, you'll be connecting it via a hosted service that itself directly accesses the database.

Depending on how your LOB web application is partitioned, you may be able to expose existing functionality as a service layer and then invoke those services from your Windows Store app via HTTP requests. The HttpClient sample should help and depending on the service implementation you can also use WCF client capabilities in Windows Store apps.

Problem

I've been asked to begin developing a Windows Store version of our company's LOB web application. What's the best way to go about interacting with out data store? My first inclination is to go the HTML/JavaScript(JQuery) route and use a web service to retrieve the data, but I'd like to attempt to use C#/XAML as I'm familiarizing myself with XAML and this would be the perfect opportunity to take a deep dive into XAML. Is Javascript the only way to communicate with out sql servers, or can I achieve this through C#/XAML? If so can anyone point me in the right direction or perhaps provide a general example of how to "connect the dots" between the WINRT framework and SQL?

Original source