title: Getting Oledb exception when updating column in excel
body: <p>I am getting the following error "No value given for one or more required parameters." On the ExceuteNonQuery() line of the below code.</p>
  
  <pre><code>        System.Data.OleDb.OleDbConnection finalConnection;
          System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand();
          string sql = null;
          finalConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source ='c:\\temp\\test.xlsx'; Extended Properties ='Excel 12.0 Xml;HDR=NO';");
          finalConnection.Open();
          myCommand.Connection = finalConnection;
          foreach (VinObject v in VinList)
              {
              sql = "Update [Sheet1$] set O = ? where S = ?;";
              myCommand.Parameters.Add(new OleDbParameter("@amt", v.CostNewAmt));
              myCommand.Parameters.Add(new OleDbParameter("@vin", v.VIN));
              myCommand.CommandText = sql;
              myCommand.ExecuteNonQuery();
              }
          finalConnection.Close();
  </code></pre>
  
  <p>I have also tried using a separate command each time, same error.</p>
  
  <pre><code>    foreach (VinObject v in VinList)
              {
              using (OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source ='c:\\temp\\test.xlsx'; Extended Properties ='Excel 12.0 Xml;HDR=No';"))
                  {
                  con.Open();
                  string query = @"UPDATE [Sheet1$] SET O = ? WHERE S = ?";
                  OleDbCommand cmd = new OleDbCommand(query, con);
                  cmd.Parameters.AddWithValue("@param1", v.CostNewAmt);
                  cmd.Parameters.AddWithValue("@param2", v.VIN);
                  cmd.ExecuteNonQuery();
                  con.Close();
                  }
              }
  </code></pre>
  
  <p>I am able to modify that into an insert and insert into a new excel spreadsheet, but for the life of me cannot get this update to work. Any idea what I am doing wrong? Thanks for the help.</p>