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