OracleConnection Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the OracleConnection.
Overloads
OracleConnection() |
Initializes a new instance of the OracleConnection. |
OracleConnection(String) |
Initializes a new instance of the OracleConnection class with the specified connection string. |
OracleConnection()
Initializes a new instance of the OracleConnection.
public:
OracleConnection();
public OracleConnection ();
Public Sub New ()
Examples
The following example creates and opens an 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
Applies to
OracleConnection(String)
Initializes a new instance of the OracleConnection class with the specified connection string.
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)
Parameters
- connectionString
- String
The connection used to open the database.
Examples
The following example creates and opens an 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