title: Arithmetic overflow in web service using C# ExecuteNonQuery
body: <p>I come to you today with a question regarding a strange error I'm getting when I try to run an insert operation using a WCF web service written in C#, specifically when running ExecuteNonQuery.</p>
  <p>This works perfectly fine in my local machine, however when I publish the service to the host machine and run the insert operation, I get this error:</p>
  <p><strong>System.OverflowException: Arithmetic operation resulted in an overflow.</strong></p>
  <p>This is strange since the return value is a simple INT that indicates a transaction number to be used. I managed to read the logs and found that the operation stops when I try to run the ExecuteNonQuery command. Even stranger, the insert actually goes through, so data is populated on the relevant table, but my service stops and doesn't return the required transaction number.</p>
  <p>Here's some excerpts from my code:</p>
  <p><strong>Conection string in Web.Config, using SQL login:</strong></p>
  <pre><code>add name=&quot;Conexion&quot; connectionString=&quot;Driver={iSeries Access ODBC Driver};System=SERVER-IP;Uid=VALID-USER;Pwd=VALID-PASS;&quot; providerName=&quot;System.Data.Odbc&quot;
  </code></pre>
  <p><strong>Create the command in the service:</strong></p>
  <pre><code>public OdbcConnection con = new OdbcConnection(ConfigurationManager.ConnectionStrings[&quot;Conexion&quot;].ConnectionString);
  OdbcCommand command = con.CreateCommand();
  </code></pre>
  <p><strong>Insert command:</strong></p>
  <pre><code>int simple3digitnumber = 0;
  
  command.CommandText = @&quot;INSERT INTO TABLE VALUE(VALUE1, VALUE2,...)&quot;;
  command.ExecuteNonQuery(); //Service dies right here, after inserting the data to the table
  simple3digitnumber = 123;
  
  return simple3digitnumber;
  </code></pre>
  <p>Reiterating, this works just fine on my local machine, but dies in the host machine AFTER it executes the insert. Any ideas as to what might be happening would be greatly appreciated.</p>
  <p>Thanks!</p>