MANAGED CODE REQUIREMENTS

Note that SQL Compact 4 and the new Sync libraries as installed with Visual Studio 2010 do not run on Compact 7 systems. It is highly recommended that you have a development machine specifically for Compact 7 development with only the 2008 version of Visual Studio installed.

A typical Compact 7 SQL Compact application will be developed as Managed Code, although it can be done as a native application. The Managed Code namespace for SQL Compact classes follows:

System.Data.SqlServerCe

You can add a reference to this:

Right-click on References in Solution Explorer, choose Add Reference, and select System.Data.SqlServerCe from the .NET tab.

Alternatively you can add a reference to SQL Server Compact in Platform Builder located at:

$(_WINCEROOT)\Others\sqlcompact\managed\Retail

Right-click on References in the Solution Explorer and choose Add Reference. Select the Browse tab as in Figure 20-6, browse to that directory, and select file system.data.sqlserverce.dll.

SqlCe Classes

A number of classes are in this namespace. They apply only to a SQL Compact database connection, not a SQL server database connection. Table 20-2 shows a list of the main ones.

TABLE 20-2: Some of the Main SqlServerCe Classes

CLASS USE
SqlCeEngine For creating new database files.
SqlCeConnection To connect to the database file. It is only a reference to the ...

Get Professional Windows® Embedded Compact 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.