SqlCeEngine.Upgrade Method (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 _
)
public void Upgrade (
string destConnectionString
)
public:
void Upgrade (
String^ destConnectionString
)
public void Upgrade (
String destConnectionString
)
public function Upgrade (
destConnectionString : String
)
參數
- destConnectionString
目的資料庫的連接字串。
範例
下列範例示範如何將先前建立的 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>
}
執行緒安全性
任何公用靜態 (共用 在 Microsoft Visual Basic) 此型別的成員具備執行緒安全。不保證任何執行個體成員安全執行緒。
平台
開發平台
Windows Vista, Windows Mobile 5.0, Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Mobile 2003 for Pocket PC, Windows CE 5.0
版本資訊
.NET Framework 及 NET Compact Framework
支援於 3.5
.NET Framework
支援於 3.0
.NET Compact Framework 及 .Net Framework
支援於 2.0
另請參閱
參考
SqlCeEngine Class
SqlCeEngine Members
System.Data.SqlServerCe Namespace