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 There is a reference to updating the table's schema for you: Here is the code related to the SQL query error message is very clear that SQL is a parameter being processed 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 and 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). 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.
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)
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">
< Code> SQL_Command.ExecuteNonQuery () .; Check the value of
SQL_Command.CommandText . Look for
@WF_IDUPDATE there.
Comments
Post a Comment