public bool CloseCon() //closing the connection to the database method { try { con.Cloase(); //attempt to close the connection return(true); //if connection is closed set value to true } catch (MySqlException ex) { MessageBox.Show(ex.Message); //Show the exeption message is the connection fails to close return(false); //the boolean value is set to false to indicate an unsucesessful close } }