OleDbFactory.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 OleDbFactory = OleDbFactory.Instance
Dim cmd As DbConnection = newFactory.CreateConnection()
OleDbFactory newFactory = OleDbFactory.Instance;
DbConnection cmd = newFactory.CreateConnection();

适用于