Im trying to insert some text that a Label has, and it wont insert it for some reason.
this is my code :
cmd = new SqlCommand(sqlquery1, conn);
cmd.Parameters.AddWithValue("Status", UserNameOrGuest.Text);
ErrorLabel.Text = "Movie rental succeeded!";
the sqlquery is : string sqlquery1 = "INSERT INTO Movies (Status) VALUES (@Status)";
Thanks for the help
You created the
SqlCommandobject but you are not executing the command to performinsertoperation. usecmd.ExecuteNonQuery()to execute the command.Check example here : SqlCommand.ExecuteNonQuery Method and SqlCommand.ExecuteScalar Method