SqlCeEngine.Upgrade Method (String)

Upgrades a SQL Server Compact database from version 3.5 to 4.0. The destination database will be encrypted if the encryption mode was specified in the Destination Connection string. The collation of the database will be case sensitive if the case-sensitive property is set to true in the connection string.

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

public function Upgrade(
	destConnectionString : String


Type: System.String
The connection string to the destination database.

The following sample demonstrates how to upgrade a previously created SQL Server Compact database to a case-sensitive SQL Server Compact database.

/// <summary>
/// Demonstrates how to upgrade a database with case sensitivity.
/// </summary>
public static void UpgradeDatabasewithCaseSensitive()
   // <Snippet2>
   // Default case-insentive connection string.
   // Note that Northwind.sdf is an old 3.1 version database.

   string connStringCI = "Data Source= Northwind.sdf; LCID= 1033";

   // Set "Case Sensitive" to true to change the collation from CI to CS.
    string connStringCS = "Data Source= Northwind.sdf; LCID= 1033; Case Sensitive=true";

   SqlCeEngine engine = new SqlCeEngine(connStringCI);
   // The collation of the database will be case sensitive because of 
   // the new connection string used by the Upgrade method.                

   SqlCeConnection conn = null;
   conn = new SqlCeConnection(connStringCI);

   //Retrieve the connection string information - notice the 'Case Sensitive' value.
   List<KeyValuePair<string, string>> dbinfo = conn.GetDatabaseInfo();

   Console.WriteLine("\nGetDatabaseInfo() results:");

   foreach (KeyValuePair<string, string> kvp in dbinfo)
   // </Snippet2>