[英]How to connect to a SQL Server database already hosted on server with windows phone 8
As I'm not that skilled in Windows Phone 8 development I would like to discuss/ask what is the best way to connect my Windows Phone 8 to a SQL Server database, I don't want to use Azure as I have already have the database present on server using for website. 由于我不熟悉Windows Phone 8开发,我想讨论/询问将Windows Phone 8连接到SQL Server数据库的最佳方法是什么,我不想使用Azure,因为我已经拥有用于网站的服务器上存在的数据库。 Please can anyone give me complete tutorial for the same or help in achieving it?
请任何人都可以给我完整相同的教程或帮助实现它吗? And after connection, I want to fire select queries only from wp8 app using text box inputs from user
在连接之后,我想使用来自用户的文本框输入仅从wp8 app激发选择查询
Check here Windows Phone 8 access to SQL remote Database 在这里检查Windows Phone 8访问SQL远程数据库
Microsoft does not allow direct connection to remote databases, so you need to have a service ont the server connected to the database, that serves the content with http requests (using xml or json to represent the data) Microsoft不允许直接连接到远程数据库,因此您需要在连接到数据库的服务器上安装服务,该服务使用http请求提供内容(使用xml或json表示数据)
The best way to do this is using Web Services. 最好的方法是使用Web服务。 In web services you can use ASP.NET Web API.
在Web服务中,您可以使用ASP.NET Web API。 Its a framework that makes it easy to build HTTP services that you can use on your windows phone, JSON or XML, you decide.
它是一个框架,可以轻松构建您可以在Windows Phone,JSON或XML上使用的HTTP服务。 In your windows phone you can use a GET, PUT, POST, and DELETE request and get the WebAPI response appropriately.
在Windows手机中,您可以使用GET,PUT,POST和DELETE请求并适当地获取WebAPI响应。
You can implement one by using these tutorials: 您可以使用以下教程实现一个:
I prefer using LINQ to query data in Web API using linq 我更喜欢使用LINQ使用linq在Web API中查询数据
Linq Samples Linq样品
For sorting purposes you can use odata: 出于分类目的,您可以使用odata:
Odata for ASP .NET Web API Odata for ASP .NET Web API
To consume the Web API : Web API with windows phone 使用Web API: 使用Windows Phone的Web API
you can also make a simple web page that takes data from your phone as query string and return data as response, this web page should work as a bridge between you and your database. 您还可以创建一个简单的网页,将手机中的数据作为查询字符串并将数据作为响应返回,此网页应作为您与数据库之间的桥梁。 and you won't have to open the page from your phone, you will just send an HTTP request and get the response , this might help you : https://msdn.microsoft.com/en-us/library/hh221581.aspx
并且您不必通过手机打开页面,只需发送HTTP请求并获得响应,这可能对您有所帮助: https : //msdn.microsoft.com/en-us/library/hh221581.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.