Compartir a través de


OracleConnection.State Propiedad

Definición

Obtiene el estado actual de la conexión.

public:
 property System::Data::ConnectionState State { System::Data::ConnectionState get(); };
public:
 virtual property System::Data::ConnectionState State { System::Data::ConnectionState get(); };
[System.ComponentModel.Browsable(false)]
public System.Data.ConnectionState State { get; }
[System.ComponentModel.Browsable(false)]
public override System.Data.ConnectionState State { get; }
[<System.ComponentModel.Browsable(false)>]
member this.State : System.Data.ConnectionState
Public ReadOnly Property State As ConnectionState
Public Overrides ReadOnly Property State As ConnectionState

Valor de propiedad

Combinación bit a bit de los valores de ConnectionState. De manera predeterminada, es Closed.

Implementaciones

Atributos

Ejemplos

En el ejemplo siguiente se crea una instancia de una clase derivada, OracleConnection, se establece y ConnectionStringse muestra su State.

public void createOracleConnection()
{
    using (OracleConnection connection = new OracleConnection())
    {
        connection.ConnectionString = "Data Source=Oracle8i;Integrated Security=yes";
        connection.Open();
        Console.WriteLine("Connection State: " + connection.State);
    }
}
Public Sub createOracleConnection()
    Using connection As New OracleConnection()
        connection.ConnectionString = _
           "Data Source=Oracle8i;Integrated Security=yes"
        connection.Open()
        Console.WriteLine("Connection State: " & connection.State)
    End Using
End Sub

Comentarios

Los cambios de estado permitidos son:

Se aplica a