Installing a Development Environment

You can develop applications that use SQL Server Compact 3.5 by using the Microsoft Visual Studio development environment. The information in this topic is also applicable to SQL Server Compact 3.5 Service Pack 1 (SP1). Visual Studio is the easiest way to develop and deploy an application that uses SQL Server Compact 3.5. In Visual Studio, you can create a managed application by using Visual C# or Visual Basic. You can also create a native application for desktop computers and devices by using Visual C++ option (previously known as Microsoft eMbedded Visual C++ 4.0). This is part of the Visual Studio 2008 suite.

Note

Microsoft eMbedded Visual Basic is not supported by SQL Server Compact 3.5 or later versions.

Visual Studio File Locations and Descriptions

The following table lists the SQL Server Compact 3.5 files, by location, that are installed on the development computer when you use Visual Studio 2008. By default, these files and folders are created in %ProgramFiles%\Microsoft Visual Studio 9.0 and in %ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\.

Location Contents

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5

SQL Server Compact 3.5 DLLs for desktop computers: sqlcecompact35.dll, sqlceca35.dll, sqlceme35.dll, sqlceoledb35.dll, sqlceqp35.dll, and sqlcese35.dll. The error descriptions DLL, sqlceer35<lang>.dll, is also installed in the folder. The error DLL for the different languages contains a two-letter suffix that indicates the language: EN, FR, and so on. The folder also contains Read Me, Licensing Terms, and Redist_<lang>.txt.

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Desktop

Managed Provider for SQL Server Compact 3.5 for Desktop: System.Data.SqlServerCe.dll

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Sync\SQL

SQL Server Compact 3.5 Server Tools DLLs for replicating data between SQL Server and SQL Server Compact 3.5: sqlcesa35.dll, sqlcerp35.dll, and ConnWiz.exe. The folder also contains the file that has the SQL Server Compact 3.5 Server Tools license terms.

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\<lang>

Localized resources for the managed provider: System.Data.SqlServerCe.resources.dll

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Devices\platform\processor

Series of subfolders. Each folder contains:

sqlce.platform.processor.cab

The sqlce.platform.processor.cab file contains sqlcese35.dll, sqlceqp35.dll, sqlceme35.dll, System.Data.SqlServerCe.dll.

sqlce.repl. platform.processor.cab

The sqlce.repl.platform.processor.cab file contains sqlceca35.dll, sqlceoledb35.dll, and sqlcecompact35.dll.

sqlce.dev.lang.platform.processor.cab The sqlce.dev.lang.platform.processor.cab file contains isqlw35.exe, a program that implements SQL Server Compact 3.5 Query Analyzer, and sqlceerr35lang.dll that provides error descriptions for use during development.

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Devices\Client

System.Data.SqlClient.dll that is used for directly connecting to the SQL Server from a mobile device without using SQL Server Compact 3.5. The CAB files for deploying SQL Server Compact 3.5 on mobile devices are sql.[platform].[processor].cab and sql.dev.[platform].[processor].cab. The CAB files are available under %ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Devicesplatform\processor.

ms171951.note(en-us,SQL.100).gifNote:
The CAB files and DLL files under the folder %ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500 are also used to install SQL Server Compact 3.5 on Windows CE 6.0 and Windows Mobile 6.0 devices.

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Include

SQL Server Compact 3.5 native header files (sqlce_sync.h, sqlce_err.h, and sqlce_oledb.h).

%ProgramFiles%\Microsoft Visual Studio 9.0\SDK\v3.5\Bootstrapper\Packages\SQL Server Compact Edition\

Series of folders that contain the SQL Server Compact 3.5 files for deploying SQL Server Compact 3.5 on desktop computers by using the ClickOnce feature of Visual Studio.

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Samples

Contains the sample database, Northwind.sdf. It also contains the NorthwindOLEDB and the IBuySpy sample that is installed by the SQL Server Compact 3.5 SP1 Samples MSI.

%ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Tools

Contains the DLLs that are used in SQL Server Management Studio for administering a SQL Server Compact database. The DLLs are installed by the SQL Server Compact 3.5 SP1 Query Tools MSI.

The files are:

Microsoft.SqlServerCe.Client.dll, Microsoft.SqlServerCe.Enumerator.dll, Microsoft.SqlServerCe.ManagementUI.dll, Microsoft.SqlServerCe.ReplWiz.dll, and ConnWiz.exe.

%ProgramFiles%\Microsoft Synchronization Services\ADO.NET\v1.0\

The DLLs for Microsoft Synchronization Services for ADO.NET are:

Microsoft.Synchronization.Data.Server.dll, Microsoft.Synchronization.Data.dll, Microsoft.Synchronization.Data.SqlServerCe.dll, and ReadMeSSC35.htm.

For information about 64-bit components, see Managing 64-bit Database Applications.

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 3.5 in the .NET Compact Framework. You can then create a database, database tables, and columns, and add data to the database.

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 %ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Desktop folder, select System.Data.SqlServerCe.dll, and then click OK.

Note

If you are developing applications by using Visual Studio, the path will be %ProgramFiles%\Microsoft SQL Server Compact Edition\v3.1. The path for SQL Server Compact 3.5 is %ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5\Desktop.

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 3.5 is revealed in the .NET Framework. You can then create a database, database tables, and columns, and add data to the database.

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 3.5 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 2005 or later versions.

To deploy a managed application to a mobile device, select Start Debugging from the Debug menu in Visual Studio 2008. 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 %ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5.

You do not have to install SQL Server Compact 3.5 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 software installation technology that is supported by SQL Server Compact 3.5 for deploying managed applications on desktop computers. 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 2008 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++.

Native Device Application Development with Visual C++

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

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

When you develop native applications by using Visual C++, you must manually copy SQL Server Compact 3.5 to the smart device. For more information, see Installing and Deploying on a Device (SQL Server Compact). SQL Server Compact 3.5 can be deployed on desktop computers by the SQL Server Compact 3.5 installer (SSCERuntime-ENU.msi).

See Also

Tasks

How to: Install SQL Server Compact on a Device

Other Resources

Developer's Guide (SQL Server Compact)

Help and Information

Getting Assistance (SQL Server Compact 3.5 Service Pack 1)