I am trying to execute a query with a condition like if username already present then update the row, else insert username and password.

This is my code below:

```
using (SqlCommand cmd = new SqlCommand("INSERT INTO Users(Username,Password) VALUES(@User,@password) ON DUPLICATE KEY UPDATE Username=VALUES(Username), Password=VALUES(Password)"))
{
    cmd.Connection = con;
    cmd.Parameters.AddWithValue("@User", TextBox3.Text);
    cmd.Parameters.AddWithValue("@password", Pwd);

    con.Open();
    cmd.ExecuteNonQuery();
}

```

I got the following error:

> 
> Incorrect syntax near the keyword 'ON'.
> 
> 
> 

I am not able to figure out what is wrong in this. Can anyone please help me out?