I am trying to take the data from excel sheet cells and update the mysql table using this query
sqlstr = "UPDATE " & table4 & " SET price = CASE WHEN key_id = '" & Cells(i, 1) & "' " & " THEN " & Cells(i, 8) & " " & " WHEN key_id = '" & Cells(i, 2) & "' " & " THEN " & Cells(i, 9) & " " & " ELSE: price "
It gives me an error:
Syntax to use near ':price'
Well, if i remove at the end the word price it gives me an error:
Syntax to use near "
I guess I am missing some quotes somewhere. How can I fix this issue?
sqlstrafter it has been created.sqlstrso we can see what it looks like after variable substitution.