共用方式為


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

適用於