MySQL Connector/Net
MySqlConnectionClose Method |
Closes the connection to the database. This is the preferred method of closing any open connection.
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll) Version: 6.9.9

public override void Close()
Public Overrides Sub Close
public: virtual void Close() override
abstract Close : unit -> unit override Close : unit -> unit
Implements
IDbConnectionClose
The Close method rolls back any pending transactions. It then releases the connection to the connection pool, or closes the connection if connection pooling is disabled.
An application can call Close more than one time. No exception is generated.

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.
