c# - Parameterized SQL UPDATE command causes Declare Scalar Variable Error -


I am trying to run an UPDATE query that receives new values ​​from user input. As a practice in caution, I chose the parameterization but there should be an error in which the parameters in which stating the block is used to declare the scalar variable '@WF_IDUPDATE' according to the manufacturer to do this < Code> SqlParameter (string, object) should create a new parameter identified by the string and take the value of the value passed in the form of the object.

There is a reference to updating the table's schema for you:

  ID integer not accepted NIT BIT NO nULL First NVARCHAR (255) No nULL Last name NVARCHAR (255) No nULL title NVARCHAR (255) Zero departmentID integer no nULL department NVARCHAR (255) No nULL timestamp DATETIME zero primary key (id)   

Here is the code related to the SQL query

  conn.Open (); SQL_Command.CommandText + = "Update WFMembers_Staging Set" + "= @Approved, [Accepted]" + "[First] = @First," + "[Last Name] = @Last," + "[Title] = @Title, "+" [Department]] = DIPTID, "+" [Department] = Deep, "+" [Timestamp] = @time "+" WHERE ID = @WF_ID "; SqlParameter = id, app, first, last, title, department, department, time; ID = new escappamator ("@ WF_ID", 42); App = new escalpimeter ("app", 0); First = new escalparator ("@First", "Bruce"); Final = new escappimeter ("@last", "Wayne"); Title = new SqlParameter ("title @", "Batman"); DeptID = New SQL parameter ("@ DPTPID", 1234); Department = New SQLParameter ("Department @", "Justice League"); Time = new SqlParameter ("@ time", date time.NEW); SQL_Command.Parameters.Add (ID); SQL_Command.Parameters.Add (app); SQL_Command.Parameters.Add (first); SQL_Command.Parameters.Add (final); SQL_Command.Parameters.Add (title); SQL_Command.Parameters.Add (DeptID); SQL_Command.Parameters.Add (Department); SQL_Command.Parameters.Add (time); SQL_Command.Connection = conn; SQL_Command.ExecuteNonQuery (); "Text" itemprop = "text"> 

error message is very clear that SQL is a parameter being processed

, and that no related parameter has been added to SqlCommand.

The name of that parameter is not included in the code you shared. The probability that it is very good that SQL is actually being executed in your question is shown in comparison to that

attempt to split into debugger

 < Code> SQL_Command.ExecuteNonQuery () .; Check the value of   

and SQL_Command.CommandText . Look for @WF_IDUPDATE there.

In addition, there is a double check that you did not run the previous version of your program after a compiler error (ie check that your code is still compiled).

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -