Skip to content
Advertisement

Query statement issue , incorrect syntax near WHERE

 con.Open();
 string query = "INSERT INTO userinfo(username, Name, Phone, Email, Address, Postalcode) values (@username, @Name, @phone, @email, @Address, @postalcode) WHERE username =" + username;

Error report:

incorrect syntax near WHERE

Advertisement

Answer

SQL INSERT statements do not support a WHERE clause. I assume you are looking for the UPDATE statement instead.

https://www.w3schools.com/sql/sql_update.asp

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement