Creating a WCF service to access a SQL database
In the business world, you will find the need to get data from custom databases, specifically SQL databases in many applications. This example will walk you through getting data from a SQL Server database and displaying it on your Windows Phone application. We will take a break from the Windows Phone in the first part of this example to build the underlying Windows Communication Foundation Service to communicate to the SQL database.
Getting ready
To start this example, we will open Visual Studio and create an ASP.NET Web Application named WCFServer:
This will provide us with the server-side piece to access the data:
1. The next step is to add a SQL Database that we will use to populate the data. We do this by right-clicking the App_Data folder and selecting to add a new SQL Database under the Data section:
2. Now that we have a database, we will want to create a table in it. To do this, double-click the database file in your Solution Explorer. This...