December 12th, 2012, 07:29 PM
Problem with parameterized update query
I am trying to update a database entry using a parameterized query, but for some reason it doesnt seem to want to work. The update statement works without the parameters there, but with them nothing happens. No errors, no crashes, and no update either.
This is the code i use:
Can anyone tell me what i am doing wrong with the code?
sqlString = "UPDATE table SET field1 = @value1, field2 = @value2, field3 = @value3 WHERE field1 = @currentValue"
dbCommand.CommandText = sqlString
dbCommand.Parameters.AddWithValue("@field2 ", txtTwo.Text)
dbCommand.Parameters.AddWithValue("@field3 ", txtThree.Text)
December 14th, 2012, 06:33 PM
I don't know the syntax for parameterized queries. I think you can instpect the values in your command object before executing the query, perhaps one of the parameter vaules is invalid. Make sure you are updating the proper database. Look for any "on error resume next" statements in your asp code that may be hiding errors.
Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.