ConnectionManagerBase.ReleaseConnection(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
释放在 期间 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在 中已开启并维护的所有连接。 该方法仅在 OfflineMode 为 时 false调用。