OracleConnection.State Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient l’état actuel de la connexion.
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
Valeur de propriété
Combinaison d'opérations de bits des valeurs ConnectionState. La valeur par défaut est Closed
.
Implémente
- Attributs
Exemples
L’exemple suivant crée un instance d’une classe dérivée, OracleConnection, définit son ConnectionStringet affiche son 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
Remarques
Les modifications d’état autorisées sont les suivantes :
De
Closed
àOpen
, à l’aide de laOpen
méthode de l’objet OracleConnection .De
Open
àClosed
, à l’aide de la Close méthode de l’objet OracleConnection .
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour