3

Just want to make sure I am not missing something. There does not appear to be a WinRT System.Data. What I am looking for is System.Data.SqlClient to connect to SQL. Can a Metro App connect to SQL? If yes can a Metro App connect to SQL in a App Store compliant manner.

paparazzo
  • 44,497
  • 23
  • 105
  • 176

1 Answers1

6

You are correct, System.Data is not there (I looked for the same thing when I first started messing around with WinRT). You won't be able to reference it either. If you want to talk to a SQL database you're going to need to use some kind of other protocol (WebService, SOAP, WCF, etc.).

There are ports for SQLite available that appear to be working which will give you a local DB option but not a server based one without using some kind of middle man to get to the DB.

As a side note, I personally would have liked to have seen a desktop Metro app that could connect to a SQL Express Database for instance but it's not currently in the cards without jumping through hoops.

b.pell
  • 3,873
  • 2
  • 28
  • 39
  • 1
    I don't think they'll add it, but you can vote for it's inclusion on the Visual Studio UserVoice site. http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2759791-make-system-data-available-to-metro-style-apps – b.pell Apr 17 '12 at 19:01
  • Local DB would be OK but I also want to get it App store and really doubt that would be certified. SO is not for complaining but I have trouble calling it a native application without SqlClient. I got SL not having SQLclient but it is was not called a native application. My target app connects to a DB behind a WebService - but it also has a local DB for disconnected operation. – paparazzo Apr 17 '12 at 21:19
  • I could be wrong, but I think that the port of SQLite for WinRT has removed the PInvoke calls and should (in theory) pass certification. I would probably want someone more familiar with the process to verify that before you spent a lot of time with it but I'm going to investigate it's usage for an app I'd like to write. I much prefer SQL Compact over SQLite but I will take SQLite over nothing (it does the job). :) – b.pell Apr 18 '12 at 00:56