OleDbConnection.ServerVersion Property

Definition

Gets a string that contains the version of the server to which the client is connected.

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

Property Value

The version of the connected server.

Attributes

Exceptions

The connection is closed.

Examples

The following example creates an OleDbConnection and displays some of its read-only properties.

C#
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.
    }
}

Remarks

The ServerVersion property maps to the OLE DB DBPROP_DBMSVER property. 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. 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.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)

See also