private void tbOrder_ModifyCottageID_Leave(object sender, EventArgs e) { if (!OrderUtils.CheckCottageID(Convert.ToInt32(tbOrder_ModifyCottageID.Text))) //Check is database contains selected cottage { return; } else { //Update order's id in database string query2 = "START TRANSACTION; " + "UPDATE varaus " + "SET mokki_mokki_id='" + tbOrder_ModifyCottageID.Text + "' " + "WHERE varaus_id=" + lbOrder_ModifyOrderID.Text + "; " + "COMMIT;"; ConnectionUtils.OpenConnection(); MySqlCommand command3 = new MySqlCommand(query2, ConnectionUtils.connection); command3.ExecuteNonQuery(); ConnectionUtils.CloseConnection(); } }