Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guys,i have a form where am using the on duplicate key update mysql syntax in webmatrix but it doesnt seem to work. i get this error message instead.

There was an error parsing the query. [ Token line number = 1,Token line offset = 71,Token in error = ON ]

here is my code below,i dont know wat am doing wrong..


SQL
var save = "insert into registration(student_number,email) VALUES(@0,@1)" +" ON DUPLICATE KEY UPDATE student_number=@0,email=@1";
     db.Execute(save,number,email);


the code seems correc but doesnt run
Posted

1 solution

try with
C#
var save = "insert into registration(student_number,email) VALUES(@0,@1) ON DUPLICATE KEY UPDATE email=VALUES(@1)";
db.Execute(save,number,email);
 
Share this answer
 
Comments
Uvie Chizzy Jakpor 14-Nov-14 2:44am    
i still get the same error mr DamithSL..

There was an error parsing the query. [ Token line number = 1,Token line offset = 62,Token in error = ON ]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900