Installing a Development Environment

You can develop applications that use Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition) by using the Microsoft Visual Studio development environment. Developing with Visual Studio is the easiest way to build and deploy an application that uses SQL Server Compact Edition. In Visual Studio, you can create a managed application by using C# or Microsoft Visual Basic, and you can create a native application for desktop and devices by using Microsoft Visual C++ option (previously known as Microsoft eMbedded Visual C++ 4.0). This is part of the Visual Studio 2005 suite.

Note

Microsoft eMbedded Visual Basic is not supported by SQL Server Compact Edition.

Visual Studio File Locations and Descriptions

The following table lists the SQL Server Compact Edition files, by location, that are installed on the development computer when you use Visual Studio 2005. By default, these files and folders are created in C:\Program Files\Microsoft Visual Studio 8.

Location Contents

\SmartDevices\SDK\SQL Server\Mobile\v3.0\platform\processor

A series of subfolders. Each folder contains:

  • sqlce30.platform.processor.cab
    The sqlce30.platform.processor.cab file contains sqlcese30.dll, sqlceqp30.dll, sqlceme30.dll, System.Data.SqlServerCe.dll.
  • sqlce30.repl.platform.processor.cab
    The sqlce30.repl.platform.processor.cab file contains sqlceca30.dll, sqlceoledb30.dll, and sqlcecompact30.dll.
  • sqlce30.dev.lang.platform.processor.cab The sqlce30.dev.lang.platform.processor.cab file contains isqlw30.exe, a program that implements SQL Server Compact Edition Query Analyzer, and sqlceerr30lang.dll that provides error descriptions for use during development.

\SmartDevices\SDK\SQL Server\Mobile\v3.0

A folder that contains the SQL Server Compact Edition Readme (ssmreadme.htm), the SQL Server Compact Edition Server Tools Setup (sqlce30setup[lang].msi), the SQL Server 2000 replication components (sql2k[lang]sp3a.msi), and the SQL Server Compact Edition native header files (ssceOleDB30.h, ca_merge30.h, and ssceerr30.h).

\SDK\v2.0\BootStrapper\Packages\SQL Server Compact Edition\

A series of folders that contain the SQL Server Compact Edition installer (SQLServerEv31-[lang]) for installing SQL Server Compact Edition on desktop computers and Tablet PCs.

Managed Application Development

For Device applications, in the Microsoft .NET Compact Framework application, add a reference to the System.Data.SqlServerCe namespace. The System.Data.SqlServerCe namespace reveals SQL Server Compact Edition in the .NET Compact Framework. You can then create a database, database tables, and columns, and populate the database with data.

For Desktop applications, in the Microsoft .NET  Framework application, add a reference to the System.Data.SqlServerCe namespace. To add the reference to the System.Data.SqlServerCe, in Solution Explorer, right–click References, and then select Add reference. In the Add Reference dialog box, click Browse, locate the %Program File%\Microsoft SQL Server Compact Edition\v3.1 folder, select System.Data.SqlServerCe.dll, and then click OK.

Note

If you are developing applications by using Visual Studio 2005 RTM version, the path to the System.Data.SqlServerCe namespace will be %Program Files%\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0. If you are developing applications by using Visual Studio 2005 SP1, the path will be %Program Files%\Microsoft SQL Server Compact Edition\v3.1.

The System.Data.SqlServerCe reference will be added to the References pane in Solution Explorer. When you add the System.Data.SqlServerCe namespace, SQL Server Compact Edition is revealed in the .NET Framework. You can then create a database, database tables, and columns, and populate the database with data.

When you build the .NET Compact Framework application that references the System.Data.SqlServerCe namespace and the application is deployed to a smart device or the Pocket PC emulator, Visual Studio automatically checks to see whether the device has the .NET Compact Framework and SQL Server Compact Edition client components installed. If these components are not detected, they are automatically installed on the device the first time that you deploy an application that references the System.Data.SqlServerCe namespace.

The .NET Compact Framework and the .NET Framework also includes the System.Data.SqlClient namespace for developing applications that directly access databases in SQL Server 2000 or later versions.

To deploy a managed application to a mobile device, select Start from the Debug menu in Visual Studio 2005. Then, decide whether you want to deploy to a connected smart device or to the Pocket PC emulator. The default installation location on the device is \Windows.

You do not have to install SQL Server Compact Edition components or the .NET Compact Framework separately on the device if you are deploying an application from Visual Studio.

ClickOnce Deployment for Deploying Managed Applications

ClickOnce is a new application deployment technology that is supported by SQL Server Compact Edition. for deploying managed applications on Desktop and Tablet PC. ClickOnce simplifies deploying a Windows-based application to a Web server or network file share. For administrators, deploying or updating an application consists of updating files on a server. You do not have to update each client individually. Visual Studio 2005 provides full support for publishing and updating applications that are deployed with ClickOnce. ClickOnce deployment is available for projects that are created by using Visual Basic, Visual C#, and Visual J#, but not for Visual C++.

How to integrate ClickOnce with SQL Server Compact Edition

Note

If you are using the original release version of Visual Studio 2005, you must perform the following steps to integrate ClickOnce with SQL Server Compact Edition. Visual Studio 2005 SP1 version automatically integrates ClickOnce with SQL Server Compact Edition.

Follow these steps to integrate ClickOnce with SQL Server Compact Edition:

  1. Download the SqlEv31ClickOnce_EN.zip file from the SQL Server. It contains the following:
    1. Product.xml, which defines the base package.
    2. Package.xml, which defines any localization-specific information or functionality.
    3. sqlev31eula-EN.txt, which contains the Microsoft Software License Terms.
      Put these files in the /SQL Server Compact Edition directory, as shown:
      %Program Files%\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\SQL Server Compact Edition\Product.xml
      %Program Files%\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\SQL Server Compact Edition\en\Package.xml
      %Program Files%\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\SQL Server Compact Edition\en\sqlev31eula-EN.txt
  2. To keep the local copy of the SQL Server Compact Edition installation file (SQLServerEv31-EN.msi), copy it  to %Program Files%\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\SQL Server Compact Edition\en folder.

Native Device Application Development with Visual C++

Visual C++ for is an option available in Visual Studio that you can use to develop native applications that use SQL Server Compact Edition.

When you develop a SQL Server Compact Edition application by using Visual C++, create a blank Visual C++ project and include SQL Server Compact Edition in the project. To do this, on the Project menu, click Add Files, and then add SsceOleDB.h, ca_mergex30.h, and Ssceerr30.h to your project.

When you develop native applications by using Visual C++, you must manually copy SQL Server Compact Edition to the smart device. For more information, see Installing and Deploying on a Device (SQL Server Compact Edition). SQL Server Compact Edition can be deployed on Desktop and Tablet PC by the SQL Server Compact Edition installer (SQLServerEv31-EN.msi).

See Also

Tasks

How to: Install SQL Server Compact Edition on a Device

Other Resources

Developer's Guide (SQL Server Compact Edition)

Help and Information

Getting SQL Server Compact Edition Assistance