title: Submit Feedback to SQL Database with C#/HTML
body: <p>I am attempting to run a C# function when a button is pressed that gets a rating (1-7) and puts it into a database along with a text input. The feedback portion:</p>
  
  <pre><code>&lt;asp:PlaceHolder ID="AnswersPlaceholder" runat="server" Visible="false"&gt;
  
  &lt;asp:Literal ID="AnswerLiteral" runat="server"&gt;&lt;/asp:Literal&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;div class="FeedbackTitle"&gt;How accurate do you find this result?&lt;/div&gt;
  
  &lt;center&gt;&lt;p&gt;&lt;input class="FeedbackChoice" type="checkbox" value="1"  name="feedback"  id="F1"&gt;Way off!&lt;/p&gt;&lt;/center&gt;
  &lt;center&gt;&lt;p&gt;&lt;input class="FeedbackChoice" type="checkbox" runat="server" value="2"  name="feedback"  id="F2"&gt;Mostly inaccurate&lt;/p&gt;&lt;/center&gt;
  &lt;center&gt;&lt;p&gt;&lt;input class="FeedbackChoice" type="checkbox" runat="server" value="3"  name="feedback"  id="F3"&gt;Somewhat accurate&lt;/p&gt;&lt;/center&gt;
  &lt;center&gt;&lt;p&gt;&lt;input type="text" style="width:40%; border: solid,thick; border-color:blue" name="Note" runat="server" class="FeedbackNote" /&gt;&lt;/p&gt;&lt;/center&gt;
  &lt;button class="ContinueButton" runat="server" onclick="SubmitFeedback_click"&gt;Continue&lt;/button&gt;
  </code></pre>
  
  <p></p>
  
  <p>and the function it calls:</p>
  
  <pre><code>protected void SubmitFeedback_Click(object sender, EventArgs e)
  {
      string FeedbackNoteString = "";
      string FeedbackButtonString =  "";
      int UseUserID = 0;
      int Feedback = 0;
      try
      {
  
          UserInfo _currentUser = UserController.Instance.GetCurrentUserInfo();
          UseUserID = _currentUser.UserID;
      }
      catch (OleDbException ex)
      {
          Console.WriteLine("Error: {0}", ex.Errors[0].Message);
      }
  
      finally
      {
  
  
      OleDbConnection bConnection = new OleDbConnection("Driver={SQL Server};Provider=SQLOLEDB........(credentials hidden)");
      OleDbCommand DoesFeedbackExistCommand = new OleDbCommand("SELECT * FROM ss_QuizFeedback WHERE UserId = " + UseUserID.ToString(), bConnection);
      OleDbDataReader DoesFeedbackExistReader = DoesFeedbackExistCommand.ExecuteReader(); SqlConnection SSSqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString);
      SqlCommand FeedbackNoteCommand = SSSqlConnection.CreateCommand();
      SqlCommand FeedbackButtonCommand = SSSqlConnection.CreateCommand();
  
      bConnection.Open();
  
      while (DoesFeedbackExistReader.Read())
      {
          Feedback++;         
      }
  
      if (Feedback == 0)
      {
              FeedbackNoteString = "INSERT INTO ss_SoulGoalsQuizFeedback (UserId,SoulGoalsNote) VALUES ("
              + UseUserID.ToString() + ","
              + Request.Form["Note"] + ")";
  
              FeedbackButtonString = "INSERT INTO ss_SoulGoalsFeedback (UserId,Rating) VALUES ("
              + UseUserID.ToString() + ","
              + Request.Form["feedback"].ToString() + ")";
      }
  
      else if (Feedback != 0)
      {
          FeedbackNoteString = "UPDATE ss_SoulGoalsQuizFeedback (UserId,SoulGoalsNote) VALUES ("
          + UseUserID.ToString() + ","
          + Request.Form["Note"] + ")";
      }   
  
      FeedbackNoteCommand.CommandText = FeedbackNoteString;
      FeedbackNoteCommand.ExecuteNonQuery();
  
      FeedbackButtonCommand.CommandText = FeedbackButtonString;
      FeedbackButtonCommand.ExecuteNonQuery();
  
      SSSqlConnection.Close();
      bConnection.Close();
  }    
  }  
  </code></pre>
  
  <p>When the button is pressed, the page refreshes but does not put them into the database. </p>