共用方式為


SqlClientFactory.Instance 欄位

定義

取得 SqlClientFactory 的執行個體。 這可以用來擷取強型別的資料物件。

public: static initonly System::Data::SqlClient::SqlClientFactory ^ Instance;
public static readonly System.Data.SqlClient.SqlClientFactory Instance;
 staticval mutable Instance : System.Data.SqlClient.SqlClientFactory
Public Shared ReadOnly Instance As SqlClientFactory 

欄位值

範例

下列代碼段會使用 Instance 屬性來擷取 SqlClientFactory 實例,然後傳回強型別 DbCommand 實例:

Dim newFactory As SqlClientFactory = SqlClientFactory.Instance
Dim cmd As DbCommand = newFactory.CreateCommand()
SqlClientFactory newFactory = SqlClientFactory.Instance;
DbCommand cmd = newFactory.CreateCommand();

適用於

另請參閱