title: ASP C# | Update Database using SQL and Stored Procedures
body: <p>Here is my OnClick event:</p>
  
  <pre><code>protected void Submit_Click(object sender, EventArgs e)
  {
      try
      {
          using (SqlConnection con = new SqlConnection(conString))
          {
              using (SqlCommand cmd = new SqlCommand("administratorUpdate", con))
              {
                  cmd.Parameters.Add("@originalID", SqlDbType.VarChar).Value = IDHF.Value;
                  cmd.Parameters.Add("@firstName", SqlDbType.VarChar).Value = firstNameTB.Text;
                  cmd.Parameters.Add("@lastName", SqlDbType.VarChar).Value = lastNameTB.Text;
                  cmd.Parameters.Add("@userName", SqlDbType.VarChar).Value = userNameTB.Text;
                  cmd.Parameters.Add("@emailAddress", SqlDbType.VarChar).Value = emailAddressTB.Text;
                  cmd.CommandType = CommandType.StoredProcedure;
              }
          }
          GetAllRPT.DataBind();
          Label ErrorMessageLabel = (Label)Master.FindControl("ErrorMessageLabel");
          new myFunctions().DisplayUserMessage("success", "Administrator Updated!", ErrorMessageLabel);
          AdminForm.Visible = false;
      }
      catch (Exception ex)
      {
          Label ErrorMessageLabel = (Label)Master.FindControl("ErrorMessageLabel");
          new myFunctions().DisplayUserMessage("error", ex.Message, ErrorMessageLabel);
      }
  }
  </code></pre>
  
  <p>Here is my Stored Procedure [administratorUpdate]:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[administratorUpdate]
      @originalID UNIQUEIDENTIFIER,
      @firstName varchar (100),
      @lastName varchar (100),
      @userName varchar (100),
      @emailAddress varchar (100),
      @password varchar (100),
      @isActive bit
  AS
  
  UPDATE administrator
  SET userName = @userName,
      emailAddress = @emailAddress,
      password = @password,
      firstName = @firstName,
      lastName = @lastName,
      isActive = @isActive
  WHERE
      ID = @originalID
  </code></pre>
  
  <p>The code executes and does the success message but the datatable doesn't update. Who knows why? I am new to using Stored Procedures in ASP.</p>