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!
Here is my stored procedure:
ALTER PROCEDURE [dbo].[sp_UpdateProj]
@ORAID INT = NULL,
@FullTitle NVARCHAR(250) = NULL
AS
BEGIN
UPDATE tbl_ProjectFile
SET FullTitle = @FullTitle
WHERE ORAID = @ORAID
END
and it works when I run it in SQL Server Management Studio, given an ID and Title name
Here is my C# 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();
}
}