共用方式為


OdbcFactory.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 實例:

Dim newFactory As OdbcFactory = OdbcFactory.Instance
Dim cmd As DbConnection = newFactory.CreateConnection()
OdbcFactory newFactory = OdbcFactory.Instance;
DbConnection cmd = newFactory.CreateConnection();

適用於