In my actual project im reading Data from a Filemaker v14 Database. Im getting the Data like that:
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() && counter < 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();
}
}
This code is running perfectly on the computer I'm developing on.
If I put my project to my IIS this error occurs:
Arithmetic operation resulted in an overflow.
in this line:s.abNR = reader["Auftrags Nr."].ToString();
I already checkt the dsn on both my computer and the server. Both seem to be the same.
The conection is created like that:
conn = new OdbcConnection("DSN=FILEMAKER1;Uid=Test;Pwd=tset");
conn.Open();
command = conn.CreateCommand();
Im looking forward to your answers!
EDIT:
This is my SalesOrder-Class:
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; }
}
EDIT 2:
Sample Data for a SalesOrder:
Aufrags Nr. | Artikel nr. | Menge | Stadt |
------------+-------------+-------+---------+
168953 | 508800 | 2 | Berlin |
------------+-------------+-------+---------+
167996 | 508850 | 4 | München |
------------+-------------+-------+---------+
FF8957 | 509010 | 1 | Berlin |
EDIT 3:
[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
System.Data.Odbc.OdbcDataReader.GetValue(Int32 i) +38
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
Produktionscockpit.Home.Page_Load(Object sender, EventArgs e) in c:\Dev\ProductionCockpit\Produktionscockpit\default.aspx.cs:21
System.Web.UI.Control.LoadRecursive() +116
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2910
SalesOrder
class look like? Additionally what data type is yourAufttrags Nr.
column? If it's larger thanInt32.Max
, you might need to explicitly convert it to something like along
prior to storing it. – UnsuccessAufttrags Nr.
column is? – UnsuccessOdbcDataReader
have similar methods as for instanceSqlDataReader
? If so, what happens if you try to usereader.GetString(0)
(assuming Auftrags Nr. is the first column)? This is not an answer but, possibly, a workaround... – Tightwad