Book Image

Windows Phone 7 Silverlight Cookbook

By : Jonathan Marbutt, Robb Schiefer
Book Image

Windows Phone 7 Silverlight Cookbook

By: Jonathan Marbutt, Robb Schiefer

Overview of this book

Silverlight has revolutionized development using Microsoft technologies. It is an excellent tool for mobile application development. The XAML-based markup and familiar C# code are the perfect combination for building apps efficiently and with minimum hassle.Packed full of recipes containing comprehensive instructions for the tasks required to build modern compelling smartphone apps using Silverlight.Starting with application design and architecture, you will quickly move on to more technical features and APIs you can implement to make your app stand out. You will use the Camera API to scan barcode, location services to pinpoint the user’s GPS coordinates and accelerometer to provide feedback based on movement of the phone. All of these features can be provided in a slick user interface through the power of Silverlight. Animations, behaviors and XAML provide all you need and more.
Table of Contents (18 chapters)
Windows Phone 7 Silverlight Cookbook
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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