ISSCEEngine.UpgradeDatabase (SQL Server Compact)

The ISSCEEngine.Upgrade method upgrades a SQL Server Compact database from version 3.5 to version 4.0. If the source database is encrypted, the upgraded database will be encrypted too. The upgraded database will be unencrypted unless you explicitly provide a password in the destination string.

object.UpgradeDatabase(SourceConnection, DestConnection)




A string value that specifies a connection to the source database (the database to be upgraded). An error occurs if the database specified by SourceConnection is already open.

DestConnection (Optional)

A string value that specifies a connection to the destination database if another file that uses the same name exists.

If DestConnection is passed as null, required properties like LCID and Password are derived from the source file.

Return type is HRESULT, and S_OK is returned on success.

HRESULT UpgradeDatabase(BSTR SourceConnection, BSTR DestConnection);

To upgrade the database file from SQL Server Compact version 3.1 to version 3.5 without creating a new file, pass the same data source property in both source and destination connection strings.

The SourceConnection and DestConnection parameters specify the properties of the source and destination databases. The following table lists the connection properties that you can specify for each parameter. All other connection properties are ignored.



Data Source

Indicates the name of the database. This property is required for both the source and destination connection information.

Locale Identifier

Indicates the locale identifier (LCID) for the new database. If this is omitted, the destination database will have the same LCID as the system locale.

LCID specifies the collating order for string comparisons in the database.

SSCE:Database Password

Indicates the password, if the database is secured by a password. The source database password must be supplied if the source database contains a password. If this parameter is omitted from the DestConnection string, the new database will have the same database password as the source database. If you want to remove the password from the destination database, the database password must be set to an empty string. The database password can be up to 40 characters long.

SSCE:Temp File Directory

Specifies the location of the temporary database. If this parameter is omitted from the DestConnection string. Then the current database location is used as the location of the temporary database.

SSCE:Encryption Mode

Specifies the destination encryption mode. If not specified, it uses Platform Default.

SSCE:Case Sensitive

Specifies whether the database is case-sensitive or not. Must be set to true to enable case sensitivity or false for case insensitivity. If not specified, the default value is false.

Note Note
This connection property was introduced in SQL Server Compact SP1.

To find a list of unique LCID values, see Supported Collations (SQL Server Compact). Make sure that the locale is supported on the application on which the database is being created.

For list of different valid encryption modes, see Upgrading from Earlier Versions (SQL Server Compact).