ConnectionManagerBase.ReleaseConnection(Object) 方法

定义

释放在 AcquireConnection(Object) 期间内建立的连接。 在设计时和运行时调用。

public:
 virtual void ReleaseConnection(System::Object ^ connection);
public virtual void ReleaseConnection (object connection);
abstract member ReleaseConnection : obj -> unit
override this.ReleaseConnection : obj -> unit
Public Overridable Sub ReleaseConnection (connection As Object)

参数

connection
Object

要释放的连接。

示例

private System.Data.OleDb.OleDbConnection oledbConnection;  
public override void ReleaseConnections()  
{  
    if (oledbConnection != null && oledbConnection.State != ConnectionState.Closed )  
        oledbConnection.Close();  
}  
Private oledbConnection As System.Data.OleDb.OleDbConnection  
Public Overrides  Sub ReleaseConnections()  
    If oledbConnection <> Nothing And oledbConnection.State <> ConnectionState.Closed Then  
        oledbConnection.Close()  
    End If  
End Sub  

注解

在运行时引擎和组件执行结束时,在组件设计期间重复调用此方法。 然后,组件释放打开和维护 AcquireConnection的任何连接。 仅当为 falseOfflineMode,才调用此方法。

适用于