Bagikan melalui


OracleConnection Konstruktor

Definisi

Menginisialisasi instans baru dari OracleConnection.

Overload

OracleConnection()

Menginisialisasi instans baru dari OracleConnection.

OracleConnection(String)

Menginisialisasi instans OracleConnection baru kelas dengan string koneksi yang ditentukan.

OracleConnection()

Menginisialisasi instans baru dari OracleConnection.

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

Contoh

Contoh berikut membuat dan membuka 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

Berlaku untuk

OracleConnection(String)

Menginisialisasi instans OracleConnection baru kelas dengan string koneksi yang ditentukan.

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)

Parameter

connectionString
String

Koneksi yang digunakan untuk membuka database.

Contoh

Contoh berikut membuat dan membuka 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

Berlaku untuk