<htmlxmlns:xlink="http://www.w3.org/1999/xlink"xmlns:MSHelp="http://msdn.microsoft.com/mshelp"xmlns:mshelp="http://msdn.microsoft.com/mshelp"xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5"xmlns:msxsl="urn:schemas-microsoft-com:xslt"><head><METAHTTP-EQUIV="Content-Type"CONTENT="text/html; charset=UTF-8"/><METANAME="save"CONTENT="history"/><title>Readme for Microsoft SQL Server Compact 4.0</title><styleTYPE="text/css">
body
{
background:#FFFFFF;
color:#000000;
font-family:Verdana;
font-size:medium;
font-style:normal;
font-weight:normal;
margin-top:0;
margin-bottom:0;
margin-left:0;
margin-right:0;
width:100%;
}
div.#mainSection
{
font-size:70%;
width:100%;
padding-left:10;
margin-right:10;
}
div.#mainBody
{
font-size:90%;
margin-top:10;
padding-bottom:20;
}
div.#header
{
background-color:#D2D2D2;
padding-top:0;
padding-bottom:0;
padding-left:10;
padding-right:0;
width:100%;
}
div.#headertable
{
border-bottom-color:#C8CDDE;
border-bottom-style:solid;
border-bottom-width:1;
width:100%;
}
span.#runningHeaderText
{
color:#003399;
font-size:90%;
}
span.#nsrTitle
{
/* color: #003399;*/
font-size:120%;
font-weight:600;
}
div.#headertabletd
{
color:#000000;
font-size:70%;
margin-top:0;
margin-bottom:0;
padding-right:20;
}
div.#headertabletr.#headerTableRow3td
{
padding-bottom:2;
padding-top:5;
}
div.#headertable.#bottomTable
{
border-top-color:#FFFFFF;
border-top-style:solid;
border-top-width:1;
text-align:left;
}
div.#footer
{
font-size:90%;
margin-top:0;
margin-bottom:0;
margin-left:-5;
margin-right:0;
padding-top:2;
padding-bottom:2;
padding-left:0;
padding-right:0;
width:100%;
}
hr.#footerHR
{
border-bottom-color:#EEEEFF;
border-bottom-style:solid;
border-bottom-width:1;
border-top-color:C8CDDE;
border-top-style:solid;
border-top-width:1;
height:3;
color:#D2D2D2;
}
div.section
{
padding-top:2;
padding-bottom:2;
padding-right:15;
width:100%;
}
.heading
{
color:#000000;
font-weight:bold;
margin-top:18;
margin-bottom:8;
}
h1.heading
{
color:#000000;
font-size:150%;
}
.subHeading
{
color:#000000;
font-weight:bold;
font-size:150%;
margin-bottom:4;
}
h2.subHeading
{
color:#000000;
font-weight:bold;
font-size:130%;
}
h3.subHeading
{
color:#000000;
font-size:125%;
font-weight:bold;
}
h4.subHeading
{
color:#000000;
font-size:110%;
font-weight:bold;
}
h4.procedureHeading
{
color:#000080;
font-size:110%;
font-weight:bold;
}
h5.subHeading
{
color:#000000;
font-size:100%;
font-weight:bold;
}
img
{
padding-bottom:10;
}
img.toggle
{
border:0;
margin-right:5;
padding-bottom:10;
}
img.copyCodeImage
{
border:0;
margin:1;
margin-right:3;
padding-bottom:10;
}
img.downloadCodeImage
{
border:0;
margin-right:3;
padding-bottom:10;
}
img.viewCodeImage
{
border:0;
margin-right:3;
padding-bottom:10;
}
img.note
{
border:0;
margin-right:3;
padding-bottom:10;
}
img.#membersOptionsFilterImage
{
border:0;
margin-left:10;
vertical-align:middle;
padding-bottom:10;
}
img.#toggleAllImage
{
margin-left:4;
vertical-align:middle;
padding-bottom:10;
}
div.#mainSectiontable
{
border:0;
font-size:100%;
width:100%;
margin-top:5px;
margin-bottom:15px;
}
div.#mainSectiontabletr
{
vertical-align:top;
}
div.#mainSectiontableth
{
text-align:left;
background:#D8D8D8;
border-bottom-color:#D8D8D8;
border-bottom-style:solid;
border-bottom-width:1;
color:#000000;
padding-left:5;
padding-right:5;
}
div.#mainSectiontabletd
{
background:#F2F2F2;
border-top-color:#D8D8D8;
border-top-style:solid;
border-top-width:1;
padding-left:5;
padding-right:5;
}
div.#mainSectiontabletd.imageCell
{
white-space:nowrap;
}
div.code
{
width:98%;
}
div.codetable
{
border:0;
font-size:95%;
margin-bottom:5;
width:100%
}
div.codetableth
{
text-align:left;
background:#D8D8D8;
border-bottom-color:#D8D8D8;
border-bottom-style:solid;
border-bottom-width:1;
color:#000000;
font-weight:bold;
padding-left:5;
padding-right:5;
}
div.codetabletd
{
background:#CCCCCC;
border-top-color:#D8D8D8;
border-top-style:solid;
border-top-width:1;
padding-left:5;
padding-right:5;
padding-top:5;
}
div.alert
{
margin-left:10;
width:98%;
}
div.alerttable
{
border:1;
font-size:100%;
width:100%;
border:solid1#DEDFEF;
}
div.alerttableth
{
text-align:left;
background:#D8D8D8;
border-bottom-width:0;
color:#000000;
padding-left:5;
padding-right:5;
border:solid1#DEDFEF;
}
div.alerttabletd
{
background:#FFFFFF;
border-top-color:#D8D8D8;
border-top-style:solid;
border-top-width:1;
padding-left:5;
padding-right:5;
border:solid1#DEDFEF;
}
span.copyCode
{
color:#0000ff;
font-size:90%;
font-weight:normal;
cursor:hand;
float:right;
display:inline;
text-align:right;
}
.downloadCode
{
color:#0000ff;
font-size:90%;
font-weight:normal;
cursor:hand;
}
.viewCode
{
color:#0000ff;
font-size:90%;
font-weight:normal;
cursor:hand;
}
div.codepre
{
font-family:Monospace,CourierNew,Courier;
font-size:105%;
color:#000000;
}
code
{
font-family:Monospace,CourierNew,Courier;
font-size:105%;
color:#000000;
}
dl
{
margin-top:0;
padding-left:1;
}
dd
{
margin-bottom:0;
margin-left:0;
padding-left:20;
}
ddp
{
margin-top:5;
}
ul
{
margin-left:17;
list-style-type:disc;
}
ulul
{
margin-bottom:4;
margin-left:17;
margin-top:3;
list-style-type:disc;
}
ol
{
margin-left:24;
list-style-type:decimal;
}
olol
{
margin-left:24;
margin-top:3;
list-style-type:lower-alpha;
}
li
{
margin-top:0;
margin-bottom:0;
padding-bottom:0;
padding-top:0;
margin-left:5;
}
lip
{
margin-top:0;
margin-bottom:0;
}
p
{
margin-bottom:15;
}
.tip
{
color:#0000FF;
font-style:italic;
cursor:hand;
text-decoration:underline;
}
.math
{
font-family:TimesNewRoman;
font-size:125%
}
.sourceCodeList
{
font-family:Verdana;
font-size:90%;
}
pre.viewCode
{
width:100%;
overflow:auto;
}
li:hovertable,li.overtable
{
background-color:#C0C0C0;
}
li:hoverul,li.overul
{
background-color:#d2d2d2;
border:1pxsolid#000;
display:block;
}
</style></head><body><divid="header"><tableid="bottomTable"cellpadding="0"cellspacing="0"><tr><tdalign="left"><spanid="nsrTitle">Readme for Microsoft SQL Server Compact 4.0</span></td></tr></table></div><divid="mainSection"><divid="mainBody"><p>11/06/2010 17:55:22</p><divclass="introduction"><p>The most up-to-date version of this file is available online at the <ahref="http://go.microsoft.com/fwlink/?LinkId=204986">Microsoft Download Center</a></p><p>The SQL Server documentation team welcomes your <ahref="mailto:sqldocfb@microsoft.com?subject=SQL%20Server%20Compact%204.0%20readme%20file(\1:SQL\2:3.5.5386.0\3:SSC_RTW\4:readme_ssc\5:ReadmeSSC35.htm\6:\7:h\8:en-us\9:2007)&body=---Please%20type%20comments%20here,%20leaving%20the%20subject%20line%20in%20place.---">documentation feedback</a>. We view and investigate all documentation issues but do not answer technical support questions here. For help with technical issues not related to documentation, see <ahref="http://go.microsoft.com/fwlink/?LinkId=204987">Getting Assistance with SQL Server Compact</a>. If it is possible, submit feedback to us in English.</p></div><aname="BKMK_Contents"/><h1class="heading">Contents</h1><divid="sectionSection0"class="section"name="collapseableSection"style=""><p><spansdata="link"><ahref="#BKMK_1.0Introduction">1.0 Introduction</a></span></p><p><spansdata="link"><ahref="#BKMK_1.1ObtainingSQLServerCompact4.0">1.1 Obtaining SQL Server Compact 4.0</a></span></p><p><spansdata="link"><ahref="#BKMK_1.2SQLServerCompact4.0BooksOnline">1.2 SQL Server Compact 4.0 Books Online</a></span></p><p><spansdata="link"><ahref="#BKMK_2.0SupportedOperatingSystemsandPlatformsforSQLServerCompact4.0">2.0 Supported Operating Systems and Platforms for SQL Server Compact 4.0</a></span></p><p><spansdata="link"><ahref="#BKMK_3.0KnownIssues">3.0 Known Issues</a></span></p><p><spansdata="link"><ahref="#BKMK_4.0AdditionalInformation">4.0 Additional Information</a></span></p><p><spansdata="link"><ahref="#BKMK_4.1GettingSQLServerCompactAssistance">4.1 Getting SQL Server Compact Assistance</a></span></p><p><spansdata="link"><ahref="#BKMK_4.2ProvidingFeedbackonSQLServerCompact">4.2 Providing Feedback on SQL Server Compact</a></span></p><p>[Return to <spansdata="link"><ahref="#BKMK_Contents">Contents</a></span>]</p></div><aname="BKMK_1.0Introduction"/><h1class="heading">1.0 Introduction</h1><divid="sectionSection1"class="section"name="collapseableSection"style=""><p>Microsoft® SQL Server™ Compact 4.0 is a small footprint, in-process database engine that allows developers to build robust applications for Windows desktop computers and for starter ASP.NET websites.</p><aname="BKMK_1.1ObtainingSQLServerCompact4.0"/><h3class="subHeading">1.1 Obtaining SQL Server Compact 4.0</h3><divclass="subsection"><p>SQL Server Compact 4.0 is available from the following Web download:</p><ul><li><p><ahref="http://go.microsoft.com/fwlink/?LinkId=204988">SQL Server Compact 4.0</a></p></li></ul><divclass="alert"><tablewidth="100%"cellspacing="0"cellpadding="0"><tr><thalign="left"><b>Important</b></th></tr><tr><td><p>The installation behavior of SQL Server Compact 4.0 on 32-bit and 64-bit operating systems has changed as compared to the previous versions of SQL Server Compact. The installation of SQL Server Compact 4.0 on 32-bit and 64-bit operating systems is as given below:</p></td></tr></table></div><divclass="caption"/><divclass="tableSection"><tablewidth="50%"cellspacing="2"cellpadding="5"frame="lhs"><tr><td><p>Version</p></td><td><p>Operating system</p></td><td><p>Result</p></td></tr><tr><td><p>32-bit, SQL Server Compact 4.0 </p></td><td><p>32-bit</p></td><td><p>Successful</p></td></tr><tr><td><p>64-bit, SQL Server Compact 4.0 </p></td><td><p>64-bit</p></td><td><p>Successful</p></td></tr><tr><td><p>32-bit, SQL Server Compact 4.0 </p></td><td><p>64-bit</p></td><td><p>Error</p></td></tr><tr><td><p>64-bit, SQL Server Compact 4.0 </p></td><td><p>32-bit</p></td><td><p>Error</p></td></tr></table></div><p>[Return to <spansdata="l
engine.CreateDatabase();</pre></td></tr></table></span></div><p>Visual Basic:</p><div class="code"><spancodeLanguage="other"><tablewidth="100%"cellspacing="0"cellpadding="0"><tr><th></th></tr><tr><tdcolspan="2"><pre>Dim engine As SqlCeEngine = New SqlCeEngine("Data Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;")
engine.CreateDatabase()</pre></td></tr></table></span></div></li><li><p>To change the encryption mode of an existing SQL Server Compact 4.0 database:</p><p>C#:</p><divclass="code"><spancodeLanguage="other"><tablewidth="100%"cellspacing="0"cellpadding="0"><tr><th></th></tr><tr><tdcolspan="2"><pre>SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf;Password=<enterStrongPasswordHere>;");
engine.Compact("Data Source=Northwind.sdf;encryption mode= enginedefault;Password=<enterStrongPasswordHere>;");</pre></td></tr></table></span></div><p>Visual Basic:</p><divclass="code"><spancodeLanguage="other"><tablewidth="100%"cellspacing="0"cellpadding="0"><tr><th></th></tr><tr><tdcolspan="2"><pre>Dim engine As SqlCeEngine = New SqlCeEngine("Data Source=Northwind.sdf;Password=<enterStrongPasswordHere>;")
engine.Compact("Data Source=Northwind.sdf;encryption mode= engine default;Password=<enterStrongPasswordHere>;")</pre></td></tr></table></span></div></li><li><p>To encrypt an unencrypted SQL Server Compact 4.0 database:
</p><p>C#:</p><divclass="code"><spancodeLanguage="other"><tablewidth="100%"cellspacing="0"cellpadding="0"><tr><th></th></tr><tr><tdcolspan="2"><pre>SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf");
engine.Compact("Data Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;");</pre></td></tr></table></span></div><p>Visual Basic:</p><divclass="code"><spancodeLanguage="other"><tablewidth="100%"cellspacing="0"cellpadding="0"><tr><th></th></tr><tr><tdcolspan="2"><pre>Dim engine As SqlCeEngine = New SqlCeEngine("Data Source=Northwind.sdf;")
engine.Compact("Data Source=Northwind.sdf;encryption mode=platform default;Password=<enterStrongPasswordHere>;"</pre></td></tr></table></span></div></li></ul></div><h3class="subHeading">3.4</h3><divclass="subsection"><p>SQL Server Compact 4.0 data types for parameters like <spanclass="parameter"sdata="paramReference">SqlDbType</span> or <spanclass="parameter"sdata="paramReference">DbType</span> should be explicitly set.
</p><p>If the data types for parameters such as <spanclass="parameter"sdata="paramReference">SqlDbType</span> or <spanclass="parameter"sdata="paramReference">DbType</span> are not explicitly set, an exception is be thrown. To resolve this issue, explicitly set the data type for parameters such as <spanclass="parameter"sdata="paramReference">SqlDbType</span> or <spanclass="parameter"sdata="paramReference">DbType</span>. This is critical in the case of BLOB data types (image and ntext). A code example is given below:</p><p>C#:</p><divclass="code"><spancodeLanguage="other"><tablewidth="100%"cellspacing="0"cellpadding="0"><tr><th></th></tr><tr><tdcolspan="2"><pre>SqlCeEngine engine = new SqlCeEngine(connString);
engine.CreateDatabase();
engine.Dispose();
SqlCeConnection conn = new SqlCeConnection(connString);
cmd.ExecuteNonQuery();</pre></td></tr></table></span></div><p>Visual Basic:</p><divclass="code"><spancodeLanguage="other"><tablewidth="100%"cellspacing="0"cellpadding="0"><tr><th></th></tr><tr><tdcolspan="2"><pre>Dim engine As SqlCeEngine = New SqlCeEngine(connString)
engine.CreateDatabase()
engine.Dispose()
Dim conn As SqlCeConnection = New SqlCeConnection(connString)