问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/10193999/winrt-system-data-connect-to-sql