SQL Server Compact 3.5 Service Pack 2 (SP2) is installed on your computer when you install Visual Studio 2010 or SQL Server 2008 R2. For scenarios where neither Visual Studio nor SQL Server are installed on your computer or where prior versions of Visual Studio or SQL Server are installed, you can use the SQL Server Compact 3.5 SP2 installer for desktop computers (SSCERuntime-ENU.msi) to install SQL Server Compact 3.5 SP2. This installer is available as a download. The SQL Server Compact 3.5 SP2 installer for desktop computers contains runtime binary files for desktop computers only. 

The installer contains the following libraries:




  • SQLCEOLEDB35.DLL (OLEDB data provider)



  • SQLCEER35xx.DLL (error messages where xx is the language)

  • System.Data.SqlServerCe.dll (ADO.NET data provider)

  • System.Data.SqlClient.dll

  • System.Data.SqlServerCe.Entity.dll

  • Microsoft.Synchronization.Data.dll

  • Microsoft.Synchronization.Data.Server.dll

  • Microsoft.Synchronization.Data.SqlServerCe.dll

Unless you are using the OLEDB data provider, the Microsoft .NET Framework 2.0 or a later version is required to install SQL Server Compact 3.5. You can download the .NET Framework 2.0 from the .NET Framework 2.0 Download Center.

The following software is not required to install SQL Server Compact on desktop computers because this installer has runtime binary files only:

  • Internet Information Services (IIS) 5.x or later versions of IIS (32-bit only)

  • ActiveSync 4.0 or later version

  • Internet Explorer 6.0

  • Neither Visual Studio nor SQL Server is required to install SQL Server Compact on desktop computers.

    To replicate data between SQL Server and SQL Server Compact, you must install replication components. For more information about SQL Server replication components, see Hardware and Software Requirements. You must also install the server tools (SSCEServerTools-ENU.msi). For more information about the server tools, see Connectivity Tools.

The SQL Server Compact 3.5 SP2 installer for desktop computers installs SQL Server Compact in a fixed location. The fixed installation location provides serviceability support for SQL Server Compact. The SQL Server Compact 3.5 SP2 Setup program will install the managed assemblies, such as System.Data.SqlServerCe.dll, in the global assembly cache (GAC), and register native DLLs, such as OLE DB Provider (sqlceoledb35.dll), in the registry.

Because of the registry installation, SQL Server Compact can only be installed by a user with administrative credentials.

SQL Server Compact 3.5 SP2 is installed at the following location: %ProgramFiles%\Microsoft SQL Server Compact Edition\v3.5. For example, if the Program Files directory is in the C drive, SQL Server Compact 3.5 runtime binaries will be installed in the C:\Program Files\Microsoft SQL Server Compact Edition\v3.5 directory.

After you install SQL Server Compact 3.5 SP2, you can see the program in Add or Remove Programs as Microsoft SQL Server Compact 3.5 SP2.

DataDirectory is a substitution string that indicates the path of the database. DataDirectory makes it easy to share a project and to deploy an application by eliminating the need to hard-code the full path. For example, instead of having the following connection string:

"Data Source= c:\program files\MyApp\Mydb.sdf"

By using |DataDirectory| (enclosed in pipe symbols as shown), you can have the following connection string:

"Data Source = |DataDirectory|\Mydb.sdf"

You set the DataDirectory property on the AppDomain by calling AppDomain.SetData.

AppDomain.SetData is not supported by the .NET Compact Framework. However, the .NET Compact Framework data provider is required to create applications for mobile devices. Therefore, if DataDirectory property is used when you program applications for mobile devices, SQL Server Compact returns an error.

If you do not set the DataDirectory property, the following default rules will be applied to access the database folder path:

  • For applications that are put in a directory on the client computer, the path of the database will be the folder in which the application is put. For example, if MyApp.exe is put in the /MyDir folder, the /MyDir folder will be accessed.

  • For applications that run under ClickOnce, a data folder is created for that purpose and will be accessed.

  • For Web applications, the App_Data folder will be accessed. You can set DataDirectory to App_Data folder by using AppDomain.SetData.