OracleConnection.ServerVersion 属性

定义

获取包含客户端所连接到的服务器的版本的字符串。Gets a string containing the version of the server to which the client is connected.

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

属性值

连接的服务器的版本。The version of the connected server.

属性

异常

连接已关闭。The connection is closed.

示例

下面的示例创建一个 OracleConnection 并显示其某些只读属性。The following example creates an OracleConnection and displays some of its read-only properties.

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);
    }
}
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 + "State: " & connection.State)
    End Using
End Sub

注解

ServerVersion 属性采用 Oracle 版本格式。The ServerVersion property is in Oracle version format. 例如,Oracle8 版本的格式为 "8.1.7.0.0 Oracle8 Release 8.1.7.0.0-生产" 格式的字符串。For example, the format for an Oracle8 release is a string in the form "8.1.7.0.0 Oracle8 Release 8.1.7.0.0 - Production."

适用于