Click to Rate and Give Feedback
MSDN
MSDN Library

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Shrink Method
[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Reclaims wasted space in the SQL Server Everywhere Edition database by moving empty pages to the end of the file, and then truncating the file.

Namespace: System.Data.SqlServerCe
Assembly:   System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

C#
public void Shrink ()
Visual Basic (Declaration)
Public Sub Shrink
Visual Basic (Usage)
Dim instance As SqlCeEngine

instance.Shrink
Visual C++
public:
void Shrink ()
JScript
public function Shrink ()

Unlike the Compact method, the Shrink method does not create a temporary database file. Instead, all empty and unallocated pages are moved to the end of the file and are then truncated, reducing the overall database size.

You can configure a database to automatically shrink by setting the AutoShrink()() property on the database.

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Compact Framework

Supported in: 3.5, 2.0

Reference

SqlCeEngine Class
SqlCeEngine Members
System.Data.SqlServerCe Namespace
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker