共用方式為


Upgrade 方法 (String)

將 SQL Server Compact 資料庫的版本從 3.1 升級至 3.5。如果 Destination Connection 字串中未指定加密模式,目標資料庫將會進行加密。如果區分大小寫屬性在連接字串中設定為 true,資料庫定序將會區分大小寫。

命名空間:  System.Data.SqlServerCe
組件:  System.Data.SqlServerCe (在 System.Data.SqlServerCe.dll 中)

語法

'宣告
Public Sub Upgrade ( _
    destConnectionString As String _
)
'用途
Dim instance As SqlCeEngine
Dim destConnectionString As String

instance.Upgrade(destConnectionString)
public void Upgrade(
    string destConnectionString
)
public:
void Upgrade(
    String^ destConnectionString
)
member Upgrade : 
        destConnectionString:string -> unit 
public function Upgrade(
    destConnectionString : String
)

參數

範例

下列範例示範如何將先前建立的 SQL Server Compact 3.5 資料庫升級為區分大小寫的 SQL Server Compact 3.5 資料庫。

/// <summary>
/// Demonstrates how to upgrade a database with case sensitivity.
/// </summary>
public static void UpgradeDatabasewithCaseSensitive()
{
   // <Snippet2>
   // Default case-insentive connection string.
   // Note that Nortwind.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.                
   engine.Upgrade(connStringCS);

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

   //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)
   {
      Console.WriteLine(kvp);
   }
   // </Snippet2>

}

請參閱

參考

SqlCeEngine類別

SqlCeEngine 成員

Upgrade 多載

System.Data.SqlServerCe 命名空間