Update or Insert a new value
<p>I have the following SQL command in asp.net:</p>

<pre><code>cmd = connection.CreateCommand();
cmd.CommandText = "INSERT INTO userscore (username, score)VALUES(@username,   @score)";
cmd.Parameters.AddWithValue("@username", username);
cmd.Parameters.AddWithValue("@score", userscore);
cmd.ExecuteNonQuery();
</code></pre>

<p>This command works but it stores two values in the my sql database every button click. It gets the score value from the textbox, but when an username + a score is in the database already, I want to update the value. Can someone help me with a query to get this done?</p>

<p>To clarify my question: I want to store the new score even when it's lower then the current score, and the username is unique in the table.</p>
