OleDbConnection.ServerVersion OleDbConnection.ServerVersion OleDbConnection.ServerVersion OleDbConnection.ServerVersion Property

定义

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

public:
 property System::String ^ ServerVersion { System::String ^ get(); };
[System.ComponentModel.Browsable(false)]
[System.Data.DataSysDescription("OleDbConnection_ServerVersion")]
public string ServerVersion { get; }
member this.ServerVersion : string
Public ReadOnly Property ServerVersion As String

属性值

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

异常

示例

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

static void OpenConnection(string connectionString)
{
    using (OleDbConnection connection = new OleDbConnection(connectionString))
    {
        try
        {
            connection.Open();
            Console.WriteLine("ServerVersion: {0}", connection.ServerVersion);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        // The connection is automatically closed when the
        // code exits the using block.
    }
}
Public Sub OpenConnection(ByVal connectionString As String)

    Using connection As New OleDbConnection(connectionString)
        Try
            connection.Open()
            Console.WriteLine("ServerVersion: {0}", connection.ServerVersion)

        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
    End Using
End Sub

注解

ServerVersion属性映射到 OLE DB DBPROP_DBMSVER 属性。The ServerVersion property maps to the OLE DB DBPROP_DBMSVER property. 如果ServerVersion基础 OLE DB 提供程序不支持,则返回空字符串。If ServerVersion is not supported by the underlying OLE DB provider, an empty string is returned.

版本的格式为 # #. # #. # ## #,其中前两位数字是主版本,接下来的两位数字是次版本号,最后四位数字是发布版本。The version is of the form ##.##.####, where the first two digits are the major version, the next two digits are the minor version, and the last four digits are the release version. 提供程序必须呈现此窗体中的产品版本,但也可以追加特定于产品的版本,例如 "04.01.0000 Rdb 4.1"。The provider must render the product version in this form but can also append the product-specific version - for example, "04.01.0000 Rdb 4.1". 此字符串的格式为 "主要版本. 次要版本. 内部版本. 内部版本号",其中主要版本号和次要版本号都是两位数,并且内部版本号正好为四位数。The string is of the form major.minor.build, where major and minor are exactly two digits and build is exactly four digits.

适用于

另请参阅