Developing a simple application using the .NET Compact Framework and SQL Server CE 2.0
Pocket PCs have come a long way over the past few years. However, their functionality in the enterprise is still somewhat unclear. The industry has made a significant range of products to assist IT professionals in achieving their mission goals, and these products come at a most important time. Most IT departments are feeling the crunch of a depressed economy, and many find themselves shorthanded, even though the workload placed on them is at its all-time high.
Many organizations, in order to alleviate this load on the IT staff, have implemented Virtual
Soccer Manager is a simple application that demonstrates how to connect and manipulate SQL CE 2.0 databases using the Microsoft .NET Compact Framework. Using Soccer Manager, you can manage players and their teams as well as organize matches. It also allows the recording of match results, all in a small amount of code! It was developed on Microsoft Visual Studio .NET 2003 out of the box.
What are .NET Compact Framework and SQLCE?
Microsoft, as with its full blown .NET Framework, has provided a common Framework for resource-constrained devices. Obviously the Pocket PC doesn't have as much memory or processing power as its desktop counterpart; therefore we should expect to see a reduced framework for the Pocket PC, or a Compact(ed) Framework.
A good idea of classes that are available in this Compact Framework and those that aren't can be seen in Figure 1.

Fig. 1. The NET.CF API documentation shows us the classes that are available for use with the Compact Framework.
The NET.CF API documentation can be downloaded from the Microsoft Dev Community site (http://smartdevices.microsoftdev.com/Downloads/Links_LinkRedirector.aspx?id=584).
SQL Server CE (SQLCE) provides our database functionality down on the Pocket PC. In the constrained environment of the Pocket PC it provides only a subset of what its big brother SQL Server provides. Nonetheless, I think that SQLCE packs a punch by supporting databases up to 1 GB in size (now, a Pocket PC with 1 GB of memory would be nice...). SQLCE even comes with its own ISQL Explorer (Fig. 2).

Fig. 2. Pocket PC SQL Explorer allows you to maintain your databases.
Starting out
To start developing data-aware .NET Compact Framework (NET.CF) applications you need:
- Visual Studio.NET 2003 (VS.NET) installed with Smart Device extensions.
- Some way to store the data. We use SQLCE, a version of which comes with VS.NET (%install dir%\ Microsoft Visual Studio.NET2003\ CompactFrameworkSDK\v1.0.5000\WindowsCE\sqlce20sql2ksp2.exe). The latest version can also be downloaded from Microsoft (www.microsoft.com/sql/ ce/downloads/ce20.asp).
(Note: For data storage we could also use XML-based files, or Pocket Access and NET.CF's LocalDataStoreSlot for storage to memory slots.)
What we need
The key ingredients of our Soccer Manager application are:
- Our application
- SQLCE system libraries installed on our Pocket PC
- A SQLCE database (cf. Microsoft's SQL Server where a database is made up of a *.MDF and an *.LDF file)