I executed the following statement but it only updates the price rows of all except Assasin creed (blank value). Also, the prices in the other rows in my table which are not defined below ironically was cleared (blank value). It seems to be working normally if i update 2 products though. What could be wrong?
(line breaks for display-wrapping only)
"UPDATE Products SET Price = IIf(Product = 'Crysis Wars'," +
CrysisWarsInput.Text +
", IIf(Product = 'Far Cry 2'," + FarCry2Input.Text +
", IIf(Product = 'Day of Defeat Source'," + DODSourceInput.Text +
", IIf(Product = 'GTA 4'," + GTA4Input.Text +
", IIf(Product = 'Asassins Creed'," + AssassinsCreedInput.Text + ")))))";
Maybe because you mis-spelt “Assasins Creed”?
Either set a WHERE clause, or add
Priceas the default value in the last IIFThat’s what a
WHEREclause is for, to restrict which records to update.You can also use a SWITCH statement instead of multiple IIFs.