简体   繁体   English

如何使用Windows Phone 8连接到服务器上已托管的SQL Server数据库

[英]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: 您可以使用以下教程实现一个:

Tutorial 教程

Another Tutorial . 另一个教程

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.

相关问题 如何在Windows Phone上将表添加到已部署的SQL Server CE数据库? - How can I add tables to an already deployed SQL Server CE Database on a Windows Phone? 将Windows Phone和Windows 8应用程序连接到SQL Server - Connect Windows Phone and Windows 8 apps to SQL Server 从windows ce通过网络连接到pc上托管的sql server数据库 - connect to sql server database hosted on pc from windows ce through network 如何将Windows Phone 8应用连接到WCF服务器 - How connect windows phone 8 app to wcf server 如何使用Windows身份验证远程连接到SQL Server数据库? - How to connect to SQL Server database using windows authentication remotely? 如何使用客户端Windows凭据连接到Web中的SQL Server数据库 - How to connect to SQL Server database in web using client windows credentials 如何从 Windows 10 UWP 应用程序连接到 SQL 服务器数据库 - How to connect to SQL server database from a Windows 10 UWP app 如何从托管在 **1&1 Ionos** 托管服务器中的 ASP.NET Core 2.2 连接 MS SQL Server 数据库? - How to connect MS SQL Server database from ASP.NET Core 2.2 hosted in **1&1 Ionos** hosting server? 无法连接到虚拟机上托管的SQL Server - Cannot connect to SQL Server hosted on Virtual Machine SQL Server的Windows Phone 8.1 Silverlight应用程序中的本地数据库 - Local database in Windows Phone 8.1 Silverlight application from SQL Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM