SqlClientFactory.CreateConnection 方法

定义

返回强类型的 DbConnection 实例。

public:
 override System::Data::Common::DbConnection ^ CreateConnection();
public override System.Data.Common.DbConnection CreateConnection ();
override this.CreateConnection : unit -> System.Data.Common.DbConnection
Public Overrides Function CreateConnection () As DbConnection

返回

的新强类型实例 DbConnection

示例

以下代码片段返回强类型 DbConnection 实例:

SqlClientFactory newFactory = SqlClientFactory.Instance;
DbConnection cmd = newFactory.CreateConnection();

适用于