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();

适用于

另请参阅