OleDbConnection.ResetState OleDbConnection.ResetState OleDbConnection.ResetState OleDbConnection.ResetState Method


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

 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.