SD7
SD7

Reputation: 514

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. 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

Upvotes: 3

Views: 7103

Answers (3)

Mawardy
Mawardy

Reputation: 3828

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

Upvotes: 0

Obvious
Obvious

Reputation: 344

The best way to do this is using Web Services. In web services you can use 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. In your windows phone you can use a GET, PUT, POST, and DELETE request and get the WebAPI response appropriately.

You can implement one by using these tutorials:

Tutorial

Another Tutorial.

I prefer using LINQ to query data in Web API using linq
Linq Samples

For sorting purposes you can use odata:

Odata for ASP .NET Web API

To consume the Web API : Web API with windows phone

Upvotes: 1

Makis Tsantekidis
Makis Tsantekidis

Reputation: 2738

Check here Windows Phone 8 access to SQL remote Database

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)

Upvotes: 5

Related Questions