private void ChangeActionType(ActionType actionType) { for (int i = 0; i < ActionTypes.Count; i++) { if (ActionTypes[i].Id == actionType.Id) { ActionTypes[i] = actionType.Clone(); } } CollectionViewSource.GetDefaultView(this.ActionTypes).Refresh(); using (con = new SQLiteConnection(connectionString)) { try { con.Open(); using (SQLiteCommand command = new SQLiteCommand(con)) { command.CommandText = "UPDATE TypAkcji SET IdTypuAkcji = @id, NazwaTypuAkcji = @actionType WHERE IdTypuAkcji='" + actionType.Id.ToString() + "'"; command.Parameters.AddWithValue("id", actionType.Id); command.Parameters.AddWithValue("actionType", actionType.Type); command.ExecuteNonQuery(); } } catch (Exception ex) { MessageBox.Show("Błąd połączenia z bazą: " + ex); } finally { con.Close(); } } }