Answered by:
[UWP] SQL connection in UWP app

Question
-
Hi, I have am existing project that runs on windows, mac, ios and android. I'm looking for a way to make a windows phone version, but I can't figure out how to use SQL. My current code base is very large and I can't "switch" to using EF. How can I get access to databases in UWP?
Thank you
- Edited by Fred Bao Friday, March 11, 2016 1:19 AM add the tag
Thursday, March 10, 2016 6:11 PM
Answers
-
Hello Phyyl,
>>Hi, I have am existing project that runs on windows, mac, ios and android. I'm looking for a way to make a windows phone version, but I can't figure out how to use SQL.
If you want to connect a local database, for example the SQLite, there are implemented libraries could be used do this stuff:
A Developer's Guide to Windows 10: (10) SQLite Local Database
If you want to connect a server-based database, for example, the SQL Server database, unfortunately, there is not a built-in API like ADO.NET that could be used to connect the SQL Server directly. And for a workaround, you would have to utilize a middle layer for example, the WCF Serrvie:
How to access data from SQL Server database in Windows Store app, although this sample is written for store app, the used approach is the same for UWP application.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.
Friday, March 11, 2016 1:33 AM
All replies
-
Are you planning to use SQL Server or you want a local sql data source for your app. If you are using local db then use SQLite. My app uses both a local db and a remote server and then it sync some of the data between my local db and sql server. I am using SQLite for local db and have created Odata services to do crud operation on my sql server.Thursday, March 10, 2016 7:20 PM
-
My app allows users to connect to their own MSSQL database...Thursday, March 10, 2016 7:23 PM
-
What do you mean by own. Will each of your device have a MSSQL?Thursday, March 10, 2016 7:32 PM
-
No, the MSSQL server is not local...Thursday, March 10, 2016 7:33 PM
-
I am assuming that your android/iPhone app access this server over the internet so how are you doing it from these devices? Have you build any kind of data access web services for these device to talk to your server?Thursday, March 10, 2016 7:40 PM
-
We don't use any web services, our app is based on different sources like XML for local (or single user) and SQL for remote (and multi user). MSSQL provides access over internet.Thursday, March 10, 2016 7:58 PM
-
Hello Phyyl,
>>Hi, I have am existing project that runs on windows, mac, ios and android. I'm looking for a way to make a windows phone version, but I can't figure out how to use SQL.
If you want to connect a local database, for example the SQLite, there are implemented libraries could be used do this stuff:
A Developer's Guide to Windows 10: (10) SQLite Local Database
If you want to connect a server-based database, for example, the SQL Server database, unfortunately, there is not a built-in API like ADO.NET that could be used to connect the SQL Server directly. And for a workaround, you would have to utilize a middle layer for example, the WCF Serrvie:
How to access data from SQL Server database in Windows Store app, although this sample is written for store app, the used approach is the same for UWP application.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.
Friday, March 11, 2016 1:33 AM -
That's very unfortunate... I thought we could have a Windows Phone version! Apparently not. Thanks anyways.
P.S.: Seeing this, I really think you need full .Net to be able to attract people to the product. IMHO.
Friday, March 11, 2016 1:36 AM