MySQL Connector/Net |
MySqlConnection..::.ServerVersion Property |
MySqlConnection Class Example See Also Send Feedback |
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.2.2.0
Syntax
C# |
---|
public override string ServerVersion { get; } |
Visual Basic (Declaration) |
---|
Public Overrides ReadOnly Property ServerVersion As String |
Visual C++ |
---|
public: virtual property String^ ServerVersion { String^ get () override; } |
Return Value
The version of the instance of MySQL.Examples
The following example creates a MySqlConnection, opens it,
displays some of its properties, then closes the connection.
CopyVB.NET
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
CopyC#
public void CreateMySqlConnection(string myConnString) { MySqlConnection myConnection = new MySqlConnection(myConnString); myConnection.Open(); MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + "\nState: " + myConnection.State.ToString()); myConnection.Close(); }
Exceptions
Exception | Condition |
---|---|
System..::.InvalidOperationException | The connection is closed. |