Sql parameter update c#




















In this case, named parameters must be used. For example:. If the parameters in the collection do not match the requirements of the query to be executed, an error may result.

Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Sql Command. Improve this question. Community Bot 1 1 1 silver badge. ExecuteNonQuery returns an integer reporting the number of rows affecting. Have you checked what that value is? Are you sure that your code is even being executed? Have you tried stepping through in the debugger? I agree with Mark.

Step through your code, making sure that all of the parameters are getting values. Why post this again? You've only added a wee bit more info stackoverflow. Okay Mark, I'm not the best debugger, but I did have my method return the rows affected, and the value is in fact, 1, meaning 1 row was updated I assume, however, no values changed. Show 1 more comment. Active Oldest Votes. Improve this answer.

Ta01 Ta01 30k 11 11 gold badges 69 69 silver badges 98 98 bronze badges. I inspected the ticketUpdated object, it doesn't contain any of the new values, it's fields are the same as the fields from the form, before the edit. Add new SqlParameter " name", newName. Add new SqlParameter " image", newImage. Add new SqlParameter " id", id ; This will let you introduce more items into your parameters without having to do deal with the headaches of explicitly indexing.

Here it all is together Add new SqlParameter " id", id ; connection. Open ; GetExample command, p. ToArray ; command. ExecuteNonQuery ; command. Improve this answer. Bob Lokerse 1 1 silver badge 6 6 bronze badges. Svek Svek 5 5 silver badges 16 16 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.

Email Required, but never shown. The Overflow Blog. Stack Gives Back



0コメント

  • 1000 / 1000