title: C#: arithmetic overflow by reading data via ODBC
body: <p>In my actual project im reading Data from a Filemaker v14 Database.
  Im getting the Data like that:</p>
  
  <pre><code>command.CommandText = "SELECT * FROM CAR";
  
  //Create new SqlDataReader object and read data from the command.
  using (OdbcDataReader reader = command.ExecuteReader())
  {
      /*
      * Get and cast the ID
      */
      int counter = 0;
      while (reader.Read() &amp;&amp; counter &lt; numberOfOrders)
      {
          SalesOrder s = new SalesOrder();
          s.abNR = reader["Auftrags Nr."].ToString();
          s.artNr = reader["Artikel nr."].ToString();
          s.quantity = reader["Menge"].ToString();
          s.city_country_Coustomer = reader["Stadt"].ToString();
      }
  }
  </code></pre>
  
  <p>This code is running perfectly on the computer I'm developing on.</p>
  
  <p>If I put my project to my IIS this error occurs:</p>
  
  <blockquote>
    <p>Arithmetic operation resulted in an overflow.</p>
  </blockquote>
  
  <p>in this line:<code>s.abNR = reader["Auftrags Nr."].ToString();</code></p>
  
  <p>I already checkt the dsn on both my computer and the server. Both seem to be the same.</p>
  
  <p>The conection is created like that: </p>
  
  <pre><code>conn = new OdbcConnection("DSN=FILEMAKER1;Uid=Test;Pwd=tset");
  conn.Open();
  
  command = conn.CreateCommand();
  </code></pre>
  
  <p>Im looking forward to your answers!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This is my SalesOrder-Class:</p>
  
  <pre><code>public class SalesOrder
  {
      public string abNR { get; set; }
      public string artNr { get; set; }
      public string quantity { get; set; }
      public string city_country_Coustomer { get; set; }
  }
  </code></pre>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Sample Data for a SalesOrder:</p>
  
  <pre><code>Aufrags Nr. | Artikel nr. | Menge | Stadt   |
  ------------+-------------+-------+---------+
    168953    |   508800    |   2   | Berlin  |
  ------------+-------------+-------+---------+
    167996    |   508850    |   4   | München |
  ------------+-------------+-------+---------+
    FF8957    |   509010    |   1   | Berlin  |
  </code></pre>
  
  <p><strong>EDIT 3:</strong></p>
  
  <blockquote>
    <p>[OverflowException: Die arithmetische Operation hat einen Überlauf
    verursacht.]    System.Data.Odbc.OdbcDataReader.GetSqlType(Int32 i)
    +359    System.Data.Odbc.OdbcDataReader.GetValue(Int32 i) +57    System.Data.Odbc.DbCache.AccessIndex(Int32 i) +82<br>
    System.Data.Odbc.OdbcDataReader.GetValue(Int32 i) +38<br>
    Produktionscockpit.SQL.FilemakerController.getActualSalesOrders(Int32
    numberOfOrders) in
    c:\Dev\ProductionCockpit\Produktionscockpit\SQL\FilemakerController.cs:56
    Produktionscockpit.Home.addSalesOrderTabelContent() in
    c:\Dev\ProductionCockpit\Produktionscockpit\default.aspx.cs:79<br>
    Produktionscockpit.Home.Page_Load(Object sender, EventArgs e) in
    c:\Dev\ProductionCockpit\Produktionscockpit\default.aspx.cs:21<br>
    System.Web.UI.Control.LoadRecursive() +116<br>
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    +2910</p>
  </blockquote>