Share via


SqlCeConnection.State 属性

获取连接的当前状态。

命名空间:  System.Data.SqlServerCe
程序集:  System.Data.SqlServerCe(在 System.Data.SqlServerCe.dll 中)

语法

声明
Public Overrides ReadOnly Property State As ConnectionState
    Get
用法
Dim instance As SqlCeConnection
Dim value As ConnectionState

value = instance.State
public override ConnectionState State { get; }
public:
virtual property ConnectionState State {
    ConnectionState get () override;
}
abstract State : ConnectionState
override State : ConnectionState
override function get State () : ConnectionState

属性值

类型:System.Data.ConnectionState
ConnectionState 值的按位组合。默认为 Closed。

实现

IDbConnection.State

注释

允许的状态更改包括:

  • 使用连接对象的 Open 方法从 Closed 更改为 Open。

  • 使用连接对象的 Close 方法或 Dispose 方法从 Closed 更改为 Open。

备注

调用 State 属性会增加应用程序的系统开销,因为每次调用都导致对打开的连接调用一次 OLE DB DBPROP_CONNECTIONSTATUS 属性。

请参阅

参考

SqlCeConnection 类

System.Data.SqlServerCe 命名空间