共用方式為


OracleConnection.DataSource 屬性

定義

取得連接的 Oracle 伺服器名稱。

public:
 property System::String ^ DataSource { System::String ^ get(); };
public:
 virtual property System::String ^ DataSource { System::String ^ get(); };
public string DataSource { get; }
[System.ComponentModel.Browsable(false)]
public override string DataSource { get; }
member this.DataSource : string
[<System.ComponentModel.Browsable(false)>]
member this.DataSource : string
Public ReadOnly Property DataSource As String
Public Overrides ReadOnly Property DataSource As String

屬性值

要連接的 Oracle 伺服器名稱。 預設值為空字串 ("")。

屬性

範例

下列範例會建立 並 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

適用於

另請參閱