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