public void editGuest() { String id = MainPage.currentrow(); string[] guest = EditGuest.Edit(); string query = "UPDATE `гость` SET `ФИО` = '" + guest[0] + "',`Дата рождения` = '" + guest[1] + "',`Паспортные данные` = '" + guest[2] + "',`Информация о прошлых заездах` = '" + guest[3] + "',`Привилегии` = '" + guest[4] + "',`Номер телефона` = '" + guest[5] + "' WHERE(`idГость` = '" + id + "')"; MySqlCommand command = new MySqlCommand(query, connection); command.CommandTimeout = 60; MySqlDataReader reader; try { connection.Open(); reader = command.ExecuteReader(); // Succesfully deleted connection.Close(); } catch (Exception ex) { // Ops, maybe the id doesn't exists ? MessageBox.Show(ex.Message); } }
private void ChangeBtn_Click(object sender, EventArgs e) { refresh_method(); EditGuest EditGuestForm = new EditGuest(); EditRoom EditRoomForm = new EditRoom(); if (dataGridView1.Visible) { EditGuestForm.Show(); } if (dataGridView2.Visible) { EditRoomForm.Show(); } }