private void Update_answer1_click(object sender, RoutedEventArgs e)
        {
            string ConnectionString = @"Data Source=DESKTOP-15P21ID;Initial Catalog=kursovoi;Integrated Security=True";

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                SqlCommand cm1 = connection.CreateCommand();
                try
                {
                    cm1.CommandText = $"UPDATE answers SET answer='{Answer1Box.Text}' WHERE id='{id_answer1}'";
                    cm1.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    MessageBox.Show("Ответ успешно изменен");
                    connection.Close();
                    Answer1Box.Clear();
                }
            }
        }
 private void Update_answers_click(object sender, RoutedEventArgs e)
 {
     combobox = Combobox1.Text;
     if (combobox == "Ответ 1")
     {
         b_answer1 = 1;
     }
     else
     {
         if (combobox == "Ответ 2")
         {
             b_answer2 = 1;
         }
         else
         {
             if (combobox == "Ответ 3")
             {
                 b_answer3 = 1;
             }
             else
             {
                 if (combobox == "Ответ 4")
                 {
                     b_answer4 = 1;
                 }
                 else
                 {
                     b_answer4 = 0;
                 }
                 b_answer3 = 0;
             }
             b_answer2 = 0;
         }
         b_answer1 = 0;
     }
     try
     {
         string ConnectionString = @"Data Source=DESKTOP-15P21ID;Initial Catalog=kursovoi;Integrated Security=True";
         using (SqlConnection connection = new SqlConnection(ConnectionString))
         {
             connection.Open();
             SqlCommand cm1 = connection.CreateCommand();
             try
             {
                 cm1.CommandText = $"UPDATE answers SET answer='{Answer1Box.Text}',is_true='{b_answer1}' WHERE id='{id_answer1}'";
                 cm1.ExecuteNonQuery();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             finally
             {
                 connection.Close();
                 Answer1Box.Clear();
             }
         }
         using (SqlConnection connection = new SqlConnection(ConnectionString))
         {
             connection.Open();
             SqlCommand cm1 = connection.CreateCommand();
             try
             {
                 cm1.CommandText = $"UPDATE answers SET answer='{Answer2Box.Text}',is_true='{b_answer2}' WHERE id='{id_answer2}'";
                 cm1.ExecuteNonQuery();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             finally
             {
                 connection.Close();
                 Answer2Box.Clear();
             }
         }
         using (SqlConnection connection = new SqlConnection(ConnectionString))
         {
             connection.Open();
             SqlCommand cm1 = connection.CreateCommand();
             try
             {
                 cm1.CommandText = $"UPDATE answers SET answer='{Answer3Box.Text}',is_true='{b_answer3}' WHERE id='{id_answer3}'";
                 cm1.ExecuteNonQuery();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             finally
             {
                 connection.Close();
                 Answer3Box.Clear();
             }
         }
         using (SqlConnection connection = new SqlConnection(ConnectionString))
         {
             connection.Open();
             SqlCommand cm1 = connection.CreateCommand();
             try
             {
                 cm1.CommandText = $"UPDATE answers SET answer='{Answer4Box.Text}',is_true='{b_answer4}' WHERE id='{id_answer4}'";
                 cm1.ExecuteNonQuery();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             finally
             {
                 connection.Close();
                 Answer4Box.Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         MessageBox.Show("Ответы успешно обновлены");
     }
 }