OracleConnection.ServerVersion 属性

定义

获取包含客户端所连接到的服务器的版本的字符串。

C#
[System.ComponentModel.Browsable(false)]
public string ServerVersion { get; }
C#
[System.ComponentModel.Browsable(false)]
public override string ServerVersion { get; }

属性值

连接的服务器的版本。

属性

例外

连接已关闭。

示例

以下示例创建 并 OracleConnection 显示其一些只读属性。

C#
public void CreateOracleConnection()
{
    string connectionString = "Data Source=Oracle8i;Integrated Security=yes";
    using (OracleConnection connection = new OracleConnection(connectionString))
    {
        connection.Open();
        Console.WriteLine("ServerVersion: " + connection.ServerVersion
            + "\nState: " + connection.State);
    }
}

注解

属性 ServerVersion 采用 Oracle 版本格式。 例如,Oracle8 版本的格式是格式为“8.1.7.0.0 Oracle8 版本 8.1.7.0.0 - 生产”的字符串。

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1