OleDbConnection.ResetState 方法

定义

更新 State 对象的 OleDbConnection 属性。Updates the State property of the OleDbConnection object.

public:
 void ResetState();
public void ResetState ();
member this.ResetState : unit -> unit
Public Sub ResetState ()

注解

某些 OLE DB 提供程序可以检查连接的当前状态。Some OLE DB providers can check the current state of the connection. 例如,如果数据库服务器已在打开 OleDbConnection之后回收,则 State 属性将继续返回 OpenFor example, if the database server has recycled since you opened your OleDbConnection, the State property will continue to return Open. 如果你正在使用支持在实时连接上对此信息进行轮询的 OLE DB 提供程序,则调用 ResetState 方法,然后检查 State 属性将告诉你连接不再打开。If you are working with an OLE DB Provider that supports polling for this information on a live connection, calling the ResetState method and then checking the State property will tell you that the connection is no longer open. ResetState 方法依赖于 OLE DB 提供程序中的功能来验证连接的当前状态。The ResetState method relies on functionality in the OLE DB Provider to verify the current state of the connection. 若要确定您的 OLE DB 提供程序是否支持此功能,请查看提供程序的文档,以获取有关 DBPROP_CONNECTIONSTATUS 的信息。To determine if your OLE DB Provider supports this functionality, check the provider's documentation for information on DBPROP_CONNECTIONSTATUS.

适用于

另请参阅