Compartilhar via


OracleConnection Construtores

Definição

Inicializa uma nova instância do OracleConnection.

Sobrecargas

OracleConnection()

Inicializa uma nova instância do OracleConnection.

OracleConnection(String)

Inicializa uma nova instância da classe OracleConnection com a cadeia de conexão especificada.

OracleConnection()

Inicializa uma nova instância do OracleConnection.

public:
 OracleConnection();
public OracleConnection ();
Public Sub New ()

Exemplos

O exemplo a seguir cria e abre um OracleConnection.

public void CreateOracleConnection()
{
    string connectionString = "Data Source=Oracle8i;Integrated Security=yes";
    using (OracleConnection connection = new OracleConnection(connectionString))
    {
        connection.Open();
        Console.WriteLine("ServerVersion: " + connection.ServerVersion
            + "\nDataSource: " + connection.DataSource);
    }
}
Public Sub CreateOracleConnection()
    Dim connectionString As String = _
       "Data Source=Oracle8i;Integrated Security=yes"

    Using connection As New OracleConnection(connectionString)
        connection.Open()
        Console.WriteLine("ServerVersion: " + connection.ServerVersion _
           + ControlChars.NewLine + "DataSource: " + connection.DataSource)
    End Using
End Sub

Aplica-se a

OracleConnection(String)

Inicializa uma nova instância da classe OracleConnection com a cadeia de conexão especificada.

public:
 OracleConnection(System::String ^ connectionString);
public OracleConnection (string connectionString);
new System.Data.OracleClient.OracleConnection : string -> System.Data.OracleClient.OracleConnection
Public Sub New (connectionString As String)

Parâmetros

connectionString
String

A conexão usada para abrir o banco de dados.

Exemplos

O exemplo a seguir cria e abre um OracleConnection.

public void CreateOracleConnection()
{
    string connectionString = "Data Source=Oracle8i;Integrated Security=yes";
    using (OracleConnection connection = new OracleConnection(connectionString))
    {
        connection.Open();
        Console.WriteLine("ServerVersion: " + connection.ServerVersion
            + "\nDataSource: " + connection.DataSource);
    }
}
Public Sub CreateOracleConnection()
    Dim connectionString As String = _
       "Data Source=Oracle8i;Integrated Security=yes"

    Using connection As New OracleConnection(connectionString)
        connection.Open()
        Console.WriteLine("ServerVersion: " + connection.ServerVersion _
           + ControlChars.NewLine + "DataSource: " + connection.DataSource)
    End Using
End Sub

Aplica-se a