Моя команда обновления не работает в ASP .NET C#
I need to update the text of a particular coulumn in database each time when i click save button that means it should not get submitted but it should get partially saved in database and next time when i click in that particular id i should see the text that i previously saved in database the problem is it is not getting updated how can i resolve this protected void btnsavenow_Click(object sender, EventArgs e) { if (Editor.Text.Length > 0) { string text = Editor.Text; string idnew = ViewState["ID"].ToString(); string naenew = Session["uid"].ToString(); string mnamenew = Session["modID"].ToString(); string snew = Session["subId"].ToString(); string anew = Session["audID"].ToString(); string qucon = "select * from Status where TID='" + idnew + "' and CBy ='" + naenew + "' and MID='" + mnamenew + "' and SID='" + snew + "' and AID='" + anew + "'"; SqlCommand cmd = new SqlCommand(qucon, con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); lblerrmsg.Text = "want to update"; string partialtext = "UPDATE Status SET partiallysavedtext = @partiallysavedtext, Completed = 0 Where TID =' " + idnew + "' and MID='" + mnamenew + "' and SID='" + snew + "' and aid='" + anew + "' and CBy ='" + naenew + "' "; cmd = new SqlCommand(partialtext,con); da = new SqlDataAdapter(cmd); cmd.Parameters.AddWithValue("@partiallysavedtext", temporarytext.ToString()); con.Open(); int i = cmd.ExecuteNonQuery(); con.Close(); }
Что я уже пробовал:
i tried above code but it is not getting updated