c# - error while updating a database in ASP.NET -


I have trouble updating a SQL database, the problem is not that it is not updated at all, but it Special parameters are not being updated while others are being updated.

Here is the code to update the parameter:

  string EditRequest = "UPDATE request SET Description = @Desc, BJustif = @Justiff, priority = @ priority, requested_system = @ Requested, request_stats = @ condition WHERE "; EditRequest + = "Req_ID = ID"; SqlConnection Deposit_Con = New SqlConnection (Web Configuration Manager. Connection Strings ["DBCon"]. ConnectionString); SqlCommand Submit_comm = New SqlCommand (EditRequest, Submit_conn); Submit_comm.Parameters.AddWithValue ("@ id", request .jQueryString ["reqid"]); Submit_comm.Parameters.AddWithValue ("@Desc", DescBox.Text); Submit_comm.Parameters.AddWithValue ("@justif", JustifBox.Text); Submit_comm.Parameters.AddWithValue ("@Primary", priority list. Selected value); Submit_comm.Parameters.AddWithValue ("@ requested", relatedbox. Text); Submit_comm.Parameters.AddWithValue ("@State", 1); Submit_conn.Open (); Submit_comm.ExecuteNonQuery (); Submit_comm.Dispose (); Submit_comm = null; Submit_conn.Close (); Get_Description (); Page Client script. Registered startupscript (this .gate type), "refresh", "reload page ();", true);  

This function is called on a pop-up form by a button which shows the parameter content that is being converted to text box that can be used to return the changes to the database Also, when I submit the submit, the parameters displayed on the form do not change, I can not find any problem regarding the code, even if I compare it with the same code. Or which is working fine.

If you need one, here's one of the text boxes I'm using to display and edit content:

  & lt; Asp: textbox id = "justifbox" textmode = "multiline" runat = "server" width = "250" height = "50" & gt; & Lt; / Asp: text box & gt;  

What is actually wrong with the code?

EDIT: I forgot to tell that when I detected the function, it appears that the control material does not change when I presented them, but they were reassigned as They were unchanged in their original form.

You have mentioned two problems

1) Fields not updated in the database When UPDATE is done

2) The UI has not been updated with the latest data

Tackling SQL Update Query What fields are not being updated? Paste the T-SQL query in the Copy Analyzer and then check which field is updating and which is not. In addition, your code is open for SQL injection, so read about it and then adjust the code.

Not updating to UI You need to see if you are populating UI areas with the right object.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -