title: using ON DUPLICATE KEY UPDATE insert query for update already exist row
body: <pre><code>connection()
  {
    OleDbConnection nwindConn=new OleDbConnection();
    MySql.Data.MySqlClient.MySqlConnection con= new MySqlConnection();
    MySqlCommand cmd;
    con.ConnectionString ="server=localhost;" +
                          "uid=root;"+
                          "pwd=;" +
                          "database=globasys;" ;
    DateTime dt=DateTime.Now;       
    string select = "SELECT CategoryID, CategoryName FROM categories";
    MySqlDataAdapter catDA = new MySqlDataAdapter(select, con);
    string insert = "insert into categories(CategoryID,CategoryName)
        VALUES(@CategoryID,@CategoryName)
        ON DUPLICATE KEY UPDATE CategoryID=@CategoryID";
    catDA.InsertCommand = new MySqlCommand(insert, con);
    catDA.InsertCommand.Parameters.Add("@CategoryID", MySqlDbType.Int32
                                       , 11, "CategoryID");
    catDA.InsertCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar
                                       , 250, "CategoryName");            
    DataSet catDS = new DataSet();
    catDA.MissingSchemaAction = MissingSchemaAction.AddWithKey;
    catDA.Fill(catDS, "Categories");
    DataSet newdt = new DataSet();
    newdt = getnewdata();        
    int i= catDA.Update(newdt, "Categories");
  }
  
  public DataSet getnewdata()
  {
    DataSet catDS=new DataSet();
    DataTable dt = new DataTable();
    DataColumn col1 = new DataColumn("CategoryID", typeof(int));
    dt.Columns.Add(col1);            
    DataColumn col=new DataColumn("CategoryName",typeof(string));
    dt.Columns.Add(col);          
    DataColumn[] Cols = { dt.Columns[0] };
    dt.PrimaryKey =Cols;
    DataRow crow = dt.NewRow();
    crow["CategoryID"]=1;
    crow["CategoryName"]="io";
    dt.Rows.Add(crow);
    dt.TableName = "Categories";            
    DataRow crow1 = dt.NewRow();
    crow1["CategoryID"] = 3;
    crow1["CategoryName"] = "p";
    dt.Rows.Add(crow1);
    dt.TableName = "Categories";
    catDS.Tables.Add(dt);
    return catDS;
  }
  </code></pre>
  
  <p>I want the insert command <code>ON DUPLICATE KEY UPDATE</code> to update the old values with the new values. If the values does not exist then it needs to insert a new value.  </p>
  
  <p>It does execute, but it does not update the existing value</p>
  
  <p>considering my table</p>
  
  <pre><code>1 a
  2 b
  </code></pre>
  
  <p>Using this query</p>
  
  <pre><code>INSERT INTO categories(CategoryID,CategoryName) 
  VALUES(1,qq) ON DUPLICATE KEY UPDATE CategoryID = 1
  </code></pre>
  
  <p>then I want the outcome to be</p>
  
  <pre><code>1 qq
  2 b
  </code></pre>