title: Radio Buttons Check + SQL Insert
body: <p>I have a few questions on my form with either an acceptable or an unacceptable option which is linked to a radio button. The issue i am having is that my check event is firing once when i check and firing again when i uncheck it, i am unsure of how to modify my code so that it only fires once per each questions answer, would this be the correct way to achieve what i am doing and insert the answers into SQL as it is semi working apart from the events which fire twice:</p>
  
  <pre><code>string answer1 = "Acceptable";
  string answer2 = "Not Acceptable";
  
  string n1;
  string n2;
  string n3;
  string n4;
  
  private void btnSubmit_Click(object sender, RoutedEventArgs e)
  {
      SqlConnection conDatabase = new SqlConnection(String.Format(@"Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", SQLSERVER_ID, SQLDatabaseName, SQLServerLoginName, SQLServerPassword));
      string query = "INSERT INTO Answers(Option1, Option2, Option3, Option4) VALUES (@Option1, @Option2, @Option3, @Option4";
  
      SqlCommand cmd = new SqlCommand(query, conDatabase);
      cmd.CommandType = CommandType.Text;
  
      conDatabase.Open();
  
      cmd.Parameters.Add("@Option1", SqlDbType.NVarChar).Value = n1;
      cmd.Parameters.Add("@Option2", SqlDbType.NVarChar).Value = n2;
      cmd.Parameters.Add("@Option3", SqlDbType.NVarChar).Value = n3;
      cmd.Parameters.Add("@Option4", SqlDbType.NVarChar).Value = n4;
  
      cmd.ExecuteNonQuery();
      conDatabase.Close();
  }
  </code></pre>
  
  <p>My xaml code is:</p>
  
  <pre><code>&lt;RadioButton x:Name="radio1a" GroupName="Question1" Checked="radioButton1_Checked"/&gt;
  &lt;RadioButton x:Name="radio1b" GroupName="Question1" Unchecked="radioButton2_Checked"/&gt;
  
  &lt;RadioButton x:Name="radio2a" GroupName="Question2" Checked="radioButton1_Checked"/&gt;
  &lt;RadioButton x:Name="radio2b" GroupName="Question2" Unchecked="radioButton2_Checked"/&gt;
  </code></pre>
  
  <p>Lastly my check is if the radio button1 for acceptable is clicked then 'n1' will be set to answer1 (acceptable) and if the radio button2 for unacceptable is clicked then 'n1' will be set to answer2 (unacceptable) - n1 being number 1 (the first question on my form):</p>
  
  <pre><code>private void radioButton1_Checked(object sender, RoutedEventArgs e)
  {
      Check();
  }
  
  private void radioButton2_Checked(object sender, RoutedEventArgs e)
  {
      Check();
  }
  
  public void Check()
  {
      if (radio1a.IsChecked == true)
      {
          n1 = answer1;
      }
      else if (radio1b.IsChecked == true)
      {
          n1 = answer2;
      }
  
      if (radio2a.IsChecked == true)
      {
          n2 = answer1;
      }
      else if (radio2b.IsChecked == true)
      {
          n2 = answer2;
      }
      .... etc.
  }
  </code></pre>