OracleConnection.DataSource 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得連接的 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