I have an ASP.Net VB shopping cart app where when an item is "Removed" from a shopping cart, and the corresponding Database field "NewTotal" is updated with the amount removed. So, that for example, if NewTotal is currently (5) and the amount being returned to inventory is QtyToAddBack (3), then the NEW "NewTotal" amount should be (8)
I am using the following code. If I use SQL Server Management Studio to run the query, it performs as expected; but in the code page it does not... what am I doing wrong.. I suspect the issue is with the "AddWithValue" definition?
Thank you in advance!
Dim strSQL02 As String = "Update [ClinicTest2].[dbo].[ICDbS_Products] SET "& _
"NewTotal = (NewTotal +'" & QtyToAddBack & "') " & _
"WHERE ProductNoID = '" & ItemNumber & "'"
Dim myCommand02 As New SqlCommand(strSQL02, objConn02)
myCommand02.Parameters.AddWithValue("@NewTotal", "@NewTotal"+ QtyToAddBack)