O'Reilly logo

Professional Windows® Embedded Compact 7 by Thierry Joubert, David Jones, Samuel Phung

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

BUILDING A SQL COMPACT DATABASE APPLICATION USING VISUAL DATA DESIGNERS

For this topic you create a Managed Code C# SmartDevice Windows Form application that can target your Compact device. Chapter 18, “Managed Code Application Example,” covers building, deploying, and testing such an application.

Getting Started

Start by creating a C# Smart Device (Device Application) project targeting Compact Framework 3.5. Name it PlayList and set the Target Platform to Windows CE, or to your device’s SDK if you have built and installed one.

In the Project Properties (Project Menu) on the Devices tab, make sure that that you uncheck Deploy the Latest Version of the .NET Framework (Including Service Packs). Otherwise Visual Studio will try to install the Framework (which is already in the OS) when you deploy the application, and the deployment will fail.

Add a reference to System.Data.SqlServerCe as in Figure 20-6 or via the .NET Add Reference tab.

Creating a New SQL Compact Server Database

To add a new database to the project, follow these steps:

1. On the Project menu, click Add New Item.

2. From the list of available Data templates, select Database File.

3. Enter MyMusic.sdf in the Name box.

4. Click Add.

The Data Source Configuration Wizard opens with the new MyMusic.sdf file chosen as the data connection, and MyMusicDataSet is the dataset name.

5. On the Choose Your Database Objects page, click Finish. (No database objects are available because this is a new database.)

MyMusic.sdf and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required