string insertNrContract = "INSERT INTO client (nr_contract) VALUES ('"
+ nr_contract + "') WHERE id_client='" + id_client + "'";
and i get the error:Incorrect syntax near the keyword 'WHERE'. I don't get what's missing. Any help? thanks


Satyapriya NayakRank #47 · 31.5K reputationPosted Apr 14, 2013, 2:55 AM EDT
use for update
string updateNrContract = "UPDATE client SET nr_contract='" + nr_contract.text + "' WHERE id_client='" + id_client .text+ "'";
sandeep Tomar30 reputationPosted Apr 14, 2013, 2:58 AM EDT
because where clause can not be use with insert , INSERT query simply insert a new row so please use update query
string insertNrContract = "UPDATE client SET nr_contract='" + nr_contract + "' WHERE id_client='" + id_client + "'";
Ravi ShekharRank #673 · 3.6K reputationPosted Apr 14, 2013, 3:21 AM EDT
Violeta Popa132 reputationPosted Apr 14, 2013, 5:28 AM EDT