title: Getting error Input string was not in a correct format when updating via MySQL
body: <p>I am getting error <code>"Input string was not in a correct format"</code> when trying to update a table via the MySQL .NET connector. </p>
  
  <p>The update statement works fine when run via MySQL workbench, but not via code and I am hoping someone can tell me why. </p>
  
  <p>Code is: </p>
  
  <pre><code>MySqlCommand command = new MySqlCommand();
  command.Connection = conn;
  command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where amazonOrderId like '" + amazonOrderId + "%';";
  command.ExecuteNonQuery();
  </code></pre>
  
  <p>I have tried both executing as a non query, and as ExecuteReader(); with no luck. </p>
  
  <p>I am sure this is a simple mistake I am making, but I can't seem to find it for the life of me so any help would be greatly appreciated. </p>
  
  <p>-- Edit --
  I have tried the following with no luck: </p>
  
  <pre><code>MySqlCommand command = new MySqlCommand();
  command.Connection = conn;
  command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where amazonOrderId like '@amazonOrderId';";
  command.Parameters.AddWithValue("@amazonOrderId", amazonOrderId);
  </code></pre>
  
  <p>also changed CommandText to: </p>
  
  <pre><code> command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where convert(varchar(50), amazonOrderId) like '" + amazonOrderId + "';";
  </code></pre>
  
  <p>and </p>
  
  <pre><code> command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where amazonOrderId = '@amazonOrderId';";
  </code></pre>
  
  <p>and </p>
  
  <pre><code>command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where amazonOrderId = @amazonOrderId;";
  </code></pre>
  
  <p>-- Resolution --</p>
  
  <p>My resolution was actually found in another piece of code. After running through the debugger several times it became apparent that a MySqlConnection object was trying to be instantiated twice - with the same name etc. I removed the second instantiation and it has resolved the issue. It's too bad the error was misleading. </p>
  
  <p>I appreciate everyone's responses as I feel they have made my code better and as such I have given +1's to Jon, Steve and Chris. Thanks for the help! </p>