Possible Duplicate:
Correct INSERT .. ON DUPLICATE KEY syntax?
Which is the correct syntax to pass parameters to INSERT … ON DUPLICATE KEY UPDATE in c# ?
I tried like this
MySqlCommand cmd = new MySqlCommand("INSERT INTO table(ID,number,color) VALUES (@r,@c,@e)
ON DUPLICATE KEY UPDATE table (number) VALUES (@c,@e) ", conn);
cmd.Parameters.AddWithValue("@r", id);
cmd.Parameters.AddWithValue("@c", a_name)
cmd.Parameters.AddWithValue("@e", a_color)
cmd.ExecuteNonQuery();
But this syntax is not correct. Any ideas?
Therefore you should have something like: