SqlServices.Install 方法

定義

在 SQL Server 資料庫上安裝指定 ASP.NET 功能的元件。

多載

Install(String, String, SqlFeatures)

在 SQL Server 資料庫上安裝選取 ASP.NET 功能的元件。

Install(String, SqlFeatures, String)

在 SQL Server 資料庫上安裝選取 ASP.NET 服務的元件。

Install(String, String, String, String, SqlFeatures)

在 SQL Server 資料庫上安裝選取 ASP.NET 功能的元件。

Install(String, String, SqlFeatures)

在 SQL Server 資料庫上安裝選取 ASP.NET 功能的元件。

public:
 static void Install(System::String ^ server, System::String ^ database, System::Web::Management::SqlFeatures features);
public static void Install (string server, string database, System.Web.Management.SqlFeatures features);
static member Install : string * string * System.Web.Management.SqlFeatures -> unit
Public Shared Sub Install (server As String, database As String, features As SqlFeatures)

參數

server
String

要安裝功能的資料庫伺服器。

database
String

要安裝功能的資料庫。

features
SqlFeatures

SqlFeatures 值的位元組合,指定要安裝的功能。

例外狀況

無法連接至指定的資料庫伺服器。

features 值包含一或多個無效旗標。

處理作業所需要的 SQL 陳述式時,會發生例外狀況。

範例

下列程式碼範例示範如何使用 Install(String, String, SqlFeatures) 類別的 SqlServices 方法。

// Install all features.
SqlServices.Install(server, database,
    SqlFeatures.All);
' Install all features.
SqlServices.Install(server, database, _
    SqlFeatures.All)

備註

如果 databasenull 或未提供, SqlServices 則會使用預設資料庫 。 aspnetdb 如果 servernull 或未提供, SqlServices 則會使用預設的 SQL Server 實例。

注意

與資料庫伺服器的連線是使用受信任的連接所建立。

另請參閱

適用於

Install(String, SqlFeatures, String)

在 SQL Server 資料庫上安裝選取 ASP.NET 服務的元件。

public:
 static void Install(System::String ^ database, System::Web::Management::SqlFeatures features, System::String ^ connectionString);
public static void Install (string database, System.Web.Management.SqlFeatures features, string connectionString);
static member Install : string * System.Web.Management.SqlFeatures * string -> unit
Public Shared Sub Install (database As String, features As SqlFeatures, connectionString As String)

參數

database
String

要安裝功能的資料庫。

features
SqlFeatures

SqlFeatures 值的位元組合,指定要安裝的功能。

connectionString
String

要使用的連接字串。 此連接字串只用來建立資料庫伺服器的連接。 在連接字串中指定資料庫是沒有作用的。

例外狀況

無法連接至指定的資料庫伺服器。

features 值包含一或多個無效旗標。

處理作業所需要的 SQL 陳述式時,會發生例外狀況。

範例

下列程式碼範例示範如何使用 Install(String, SqlFeatures, String) 類別的 SqlServices 方法。

// Install membership and personalization.
SqlServices.Install(database,
    SqlFeatures.Membership &
    SqlFeatures.Personalization,
    connectionString);
' Install membership and personalization.
SqlServices.Install(database, _
    SqlFeatures.Membership And _
    SqlFeatures.Personalization, _
    connectionString)

備註

如果 databasenull 或未提供, SqlServices 則會使用預設資料庫 。 aspnetdb

另請參閱

適用於

Install(String, String, String, String, SqlFeatures)

在 SQL Server 資料庫上安裝選取 ASP.NET 功能的元件。

public:
 static void Install(System::String ^ server, System::String ^ user, System::String ^ password, System::String ^ database, System::Web::Management::SqlFeatures features);
public static void Install (string server, string user, string password, string database, System.Web.Management.SqlFeatures features);
static member Install : string * string * string * string * System.Web.Management.SqlFeatures -> unit
Public Shared Sub Install (server As String, user As String, password As String, database As String, features As SqlFeatures)

參數

server
String

要安裝功能的資料庫伺服器。

user
String

連接至資料庫時使用的使用者名稱。

password
String

連接至資料庫時使用的密碼。

database
String

要安裝功能的資料庫。

features
SqlFeatures

SqlFeatures 值的位元組合,指定要安裝的功能。

例外狀況

無法連接至指定的資料庫伺服器。

features 值包含一或多個無效旗標。

處理作業所需要的 SQL 陳述式時,會發生例外狀況。

備註

如果 databasenull 或未提供, SqlServices 則會使用預設資料庫 。 aspnetdb 如果 servernull 或未提供, SqlServices 則會使用預設的 SQL Server 實例。

注意

與資料庫伺服器的連線是使用受信任的連接所建立。

另請參閱

適用於