title: Using a stored procedure to update columns in C#
body: <p>I am trying to update columns in my table by filling out text boxes and clicking save; I don't get an error or anything. Just nothing happens!</p>
  
  <p>Here is my stored procedure:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[sp_UpdateProj]
      @ORAID INT = NULL,
      @FullTitle NVARCHAR(250) = NULL
  AS
  BEGIN
      UPDATE tbl_ProjectFile
      SET FullTitle = @FullTitle
      WHERE ORAID = @ORAID
  END
  </code></pre>
  
  <p>and it works when I run it in SQL Server Management Studio, given an ID and Title name</p>
  
  <p>Here is my C# code</p>
  
  <pre><code>protected void Button_Save_Click(object sender, EventArgs e)
  {
      string connectionStr = ConfigurationManager.ConnectionStrings["ORAProjectConnectionString"].ConnectionString;
      using (SqlConnection con = new SqlConnection(connectionStr))
      {
          con.Open();
  
          string query = "sp_UpdateProj Where ORAID=" + int.Parse(TextBox_ORAID.Text);
  
          SqlCommand cmd = new SqlCommand(query, con);
          cmd.CommandType = CommandType.StoredProcedure;
          cmd.Connection = con;
  
          cmd.Parameters.AddWithValue("@ORAID", Convert.ToInt32(TextBox_ORAID.Text));
          cmd.Parameters.AddWithValue("@FullTitle", TextBox_FullTitle.Text);
  
          con.Close();
      }
  }
  </code></pre>