MySqlConnection.ServerVersion Property

MySQL Connector/Net

MySqlConnectionServerVersion Property
Gets a string containing the version of the MySQL server to which the client is connected.

Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll) Version: 6.9.9
Syntax
public override string ServerVersion { get; }
Public Overrides ReadOnly Property ServerVersion As String
	Get
public:
virtual property String^ ServerVersion {
	String^ get () override;
}
abstract ServerVersion : string with get
override ServerVersion : string with get

Return Value

Type: String
The version of the instance of MySQL.
Exceptions
ExceptionCondition
InvalidOperationExceptionThe connection is closed.
Examples
The following example creates a MySqlConnection, opens it, displays some of its properties, then closes the connection.
public void CreateMySqlConnection(string myConnString)
{
MySqlConnection myConnection = new MySqlConnection(myConnString);
myConnection.Open();
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
"\nState: " + myConnection.State.ToString());
myConnection.Close();
}
Public Sub CreateMySqlConnection(myConnString As String)
Dim myConnection As New MySqlConnection(myConnString)
myConnection.Open()
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.Cr + "State: " + myConnection.State.ToString())
myConnection.Close()
End Sub

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also