The most
up-to-date version of this file is available online at the
The SQL Server documentation team welcomes your |
Contents
1.1 Obtaining SQL
Server Compact 4.0 CTP1
1.2 SQL Server Compact 4.0 CTP1
Books Online
1.3 Microsoft
Synchronization Services for ADO.NET
2.0 Supported Operating
Systems and Platforms for SQL Server Compact 4.0 CTP1
4.1 Getting
SQL Server Compact 4.0 CTP1 Assistance
1.0 Introduction
Microsoft® SQL Server™ Compact
4.0 Community Technology Preview 1 is a small footprint, in-process database
engine that allows developers to build robust applications for Windows desktop
computers and mobile devices.
1.1 Obtaining SQL Server Compact 4.0 CTP1
SQL Server Compact 4.0 CTP1 is
available from the following Web download:
·
SQL Server Compact 4.0 CTP1 (32-bit and 64-bit releases).
Note: Unlike the previous versions of SQL Server Compact, the 32-bit version of
the SQL Server Compact 4.0 CTP1 only installs on a 32-bit computer and the
64-bit version of the SQL Server Compact 4.0 CTP1 only installs on a 64-bit
computer. Installing the 32-bit
version of the SQL Server Compact 4.0 CTP1 on a 64-bit computer or installing
the 64-bit version of the SQL Server Compact 4.0 CTP1 on a 32-bit computer
results in an error.
2.0 Supported Operating Systems and Platforms for SQL Server
Compact 4.0 CTP1
SQL Server Compact 4.0
CTP1 supports the following operating systems.
Windows Desktop Computers
·
Microsoft Windows XP
Professional SP3
·
Microsoft Windows XP
Home Edition SP3
·
Microsoft Windows XP
Media Center Edition 2004 SP3
·
Microsoft Windows XP
Media Center Edition 2005
·
Microsoft Windows XP
Tablet PC Edition SP3
·
Microsoft Windows XP
Embedded SP3
·
Microsoft Windows XP
Professional x64 SP3
·
Windows Embedded for
Point of Service SP3
·
Microsoft Windows Server
2003, Standard Edition SP2
·
Microsoft Windows Server
2003, Enterprise Edition SP2
·
Microsoft Windows Server
2003, Datacenter Edition SP2
·
Microsoft Windows Server
2003 R2, Standard Edition
·
Microsoft Windows Server
2003 R2, Enterprise Edition
·
Microsoft Windows Server
2003 R2, Datacenter Edition
·
Microsoft Windows Server
2003 x64, Standard Edition
·
Microsoft Windows Server
2003 x64, Enterprise x64 Edition
·
Microsoft Windows Server
2003 x64, Datacenter Edition
·
Microsoft Windows Server
2003 R2 x64, Standard Edition
·
Microsoft Windows Server
2003 R2 x64, Enterprise Edition
·
Microsoft Windows Server
2003 R2 x64, Datacenter Edition
·
Windows Vista Home Basic
SP2
·
Windows Vista Home
Premium SP2
·
Windows Vista Business
SP2
·
Windows Vista Enterprise
SP2
·
Windows Vista Ultimate
SP2
·
Windows Vista Starter
Edition SP2
·
Windows Vista Home Basic
x64 SP2
·
Windows Vista Home
Premium x64 SP2
·
Windows Vista Business
x64 SP2
·
Windows Vista Enterprise
x64 SP2
·
Windows Vista Ultimate
x64 SP2
·
Windows Server 2008
Standard Server SP2
·
Windows Server 2008
Standard Server SP2 (without Hyper-V)
·
Windows Server 2008
Enterprise SP2
·
Windows Server 2008
Enterprise SP2 (without Hyper-V)
·
Windows Server 2008 Data
Center SP2
·
Windows Server 2008 Data
Center SP2 (without Hyper-V)
·
Windows Server 2008 Web
Edition SP2
·
Windows Server 2008
Standard Server SP2 x64
·
Windows Server 2008
Standard Server SP2 x64 (without Hyper-V)
·
Windows Server 2008
Enterprise SP2 x64
·
Windows Server 2008
Enterprise SP2 x64 (without Hyper-V)
·
Windows Server 2008 Data
Center SP2 x64
·
Windows Server 2008 Data
Center SP2 x64 (without Hyper-V)
·
Windows Server 2008 Web
Edition SP2 x64
·
Windows 7 Starter
·
Windows 7 Starter x64
·
Windows 7 Home Premium
·
Windows 7 Home Premium
x64
·
Windows 7 Professional
·
Windows 7 Professional
x64
·
Windows 7 Ultimate
·
Windows 7 Ultimate x64
·
Windows Server 2008 R2
Foundation x64
·
Windows Server 2008 R2
Standard x64
·
Windows Server 2008 R2
Enterprise x64
·
Windows Server 2008 R2
Datacenter x64
·
Windows Web Server 2008
R2 x64
.NET Framework
·
.NET Framework 3.5 SP1
Client Profile
·
.NET Framework 3.5 SP1
·
.NET 4 Framework
Standalone version
·
.NET Framework 4 Client
Profile
·
.NET Framework 4 Client
Profile Standalone version
3.1
The native DLLs
of SQL Server Compact 4.0 CTP1 need the Microsoft Visual C++ 2008 Runtime
Libraries (x86 and x64), Service Pack 1. Installing the SQL Server Compact 4.0
CTP1 using the Installer file, also installs the Visual C++ 2008 Runtime
Libraries SP1. If SQL Server Compact 4.0 CTP1 is deployed privately in the
application’s folder the following have to be present on the machine for SQL
Server Compact to function properly:
·
Installing the .NET Framework 3.5 SP1 also installs the Visual C++ 2008
Runtime Libraries SP1
·
Visual C++ 2008 Runtime Libraries SP1 can be downloaded and installed
from the location given below: http://go.microsoft.com/fwlink/?LinkId=194827
Note that
installing .NET Framework 2.0 or .NET Framework 3.0 or .NET Framework 4 does not
install the Visual C++ 2008 Runtime Libraries (x86 and x64), Service Pack 1.
3.2
SQL Server Compact 4.0 CTP1 does not recognize the Encrypt
property of the SqlCeConnection
class, and you should not use this property to encrypt database files.
Note: |
The Encrypt property was deprecated in
SQL Server Compact v3.5 release. This property was retained in SQL Server
Compact 3.5 only for backward compatibility. |
Use the Encryption
Mode property of the SqlCeConnection class to encrypt SQL Server Compact 4.0 CTP1
database files. The following examples show uses of the Encryption Mode
property:
·
To create a new
encrypted SQL Server Compact 4.0 CTP1
database:
C#:
SqlCeEngine engine = new SqlCeEngine("Data
Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;"); engine.CreateDatabase(); |
Visual Basic:
Dim engine As SqlCeEngine = New SqlCeEngine("Data
Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;") engine.CreateDatabase() |
·
To change the encryption
mode of an existing SQL Server Compact 4.0 CTP1
database:
C#:
SqlCeEngine engine = new SqlCeEngine("Data
Source=Northwind.sdf;Password=<enterStrongPasswordHere>;"); engine.Compact("Data Source=Northwind.sdf;encryption
mode=ppc2003 compatibility;Password=<enterStrongPasswordHere>;"); |
Visual Basic:
Dim engine As SqlCeEngine = New SqlCeEngine("Data
Source=Northwind.sdf;Password=<enterStrongPasswordHere>;") engine.Compact("Data Source=Northwind.sdf;encryption
mode=ppc2003 compatibility;Password=<enterStrongPasswordHere>;") |
·
To encrypt an
unencrypted SQL Server Compact 4.0 CTP1
database:
C#:
SqlCeEngine engine = new SqlCeEngine("Data
Source=Northwind.sdf"); engine.Compact("Data Source=Northwind.sdf;encryption
mode=platform default;Password=<enterStrongPasswordHere>;"); |
Visual Basic:
Dim engine As SqlCeEngine = New SqlCeEngine("Data
Source=Northwind.sdf;") engine.Compact("Data Source=Northwind.sdf;encryption
mode=platform default;Password=<enterStrongPasswordHere>;") |
3.3
SQL Server Compact 4.0 CTP1 data types for parameters like SqlDbType or DbType
should be explicitly set.
If the data types for parameters such as SqlDbType
or DbType are not explicitly set, an exception
will be thrown. To resolve this issue, explicitly set the data type for
parameters such as SqlDbType or DbType. This is critical in the case of BLOB data
types (image and ntext). A code example is given
below:
C#:
SqlCeEngine engine = new SqlCeEngine(connString); engine.CreateDatabase(); engine.Dispose(); SqlCeConnection conn = new SqlCeConnection(connString); conn.Open(); SqlCeCommand cmd = conn.CreateCommand(); cmd.CommandText = "CREATE TABLE BlobTable(name nvarchar(128),
blob ntext);"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO BlobTable(name, blob) VALUES (@name, @blob);"; SqlCeParameter paramName =
cmd.Parameters.Add("name", SqlDbType.NVarChar, 128); SqlCeParameter paramBlob =
cmd.Parameters.Add("blob", SqlDbType.NText); paramName.Value = "Name1"; paramBlob.Value = "Name1".PadLeft(4001); cmd.ExecuteNonQuery(); |
Visual Basic:
Dim engine As SqlCeEngine = New SqlCeEngine(connString) engine.CreateDatabase() engine.Dispose() Dim conn As SqlCeConnection = New SqlCeConnection(connString) conn.Open() Dim cmd As SqlCeCommand = conn.CreateCommand() cmd.CommandText = "CREATE TABLE BlobTable(name nvarchar(128),
blob ntext);" cmd.ExecuteNonQuery() cmd.CommandText = "INSERT INTO BlobTable(name, blob) VALUES (@name, @blob);" Dim paramName As SqlCeParameter Dim paramBlob As SqlCeParameter paramName = cmd.Parameters.Add("name",
SqlDbType.NVarChar, 128) paramBlob = cmd.Parameters.Add("blob",
SqlDbType.NText) paramName.Value = "Name1" paramBlob.Value = "Name1".PadLeft(4001) cmd.ExecuteNonQuery() |
3.4
Uninstallation
of SQL Server Compact runtime using command line options does not work in this
CTP release.
For
uninstallation of SQL Server Compact runtime go to Add/remove programs
(Start->Run->appwiz.cpl), and right click on
the entry ‘Microsoft SQL Server Compact 4.0 <<processor architecture>>*
ENU CTP1’, and select uninstall from the menu.
<<processor
architecture>> - X86 for 32 bit machines, X64 for 64 bit machines
4.0 Additional Information
This
section describes how to obtain assistance and provide feedback about SQL
Server Compact.
4.1 Getting SQL Server Compact Assistance
For more information, see the
4.2 Providing Feedback on SQL Server Compact
To provide suggestions and bug
reports about SQL Server Compact:
·
Make suggestions and
file bug reports about the features or the user interface of SQL Server Compact
at the
·
Send suggestions or
report inaccuracies in the documentation by using the feedback functionality in
SQL Server Compact Books Online.