Fel*_*ber 5 c# sql asp.net filemaker
在我的实际项目中,我从 Filemaker v14 数据库中读取数据。我得到这样的数据:
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();
}
}
Run Code Online (Sandbox Code Playgroud)
这段代码在我正在开发的计算机上完美运行。
如果我将我的项目放到我的 IIS 中,则会发生此错误:
算术运算导致溢出。
在这一行:s.abNR = reader["Auftrags Nr."].ToString();
我已经在我的计算机和服务器上检查了 dsn。两者似乎是一样的。
连接是这样创建的:
conn = new OdbcConnection("DSN=FILEMAKER1;Uid=Test;Pwd=tset");
conn.Open();
command = conn.CreateCommand();
Run Code Online (Sandbox Code Playgroud)
我期待你的回答!
编辑:
这是我的 SalesOrder 类:
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; }
}
Run Code Online (Sandbox Code Playgroud)
编辑2:
SalesOrder 的示例数据:
Aufrags Nr. | Artikel nr. | Menge | Stadt |
------------+-------------+-------+---------+
168953 | 508800 | 2 | Berlin |
------------+-------------+-------+---------+
167996 | 508850 | 4 | München |
------------+-------------+-------+---------+
FF8957 | 509010 | 1 | Berlin |
Run Code Online (Sandbox Code Playgroud)
编辑 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\Filemaker6Controller 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.asp cs:21
System.Web.UI.Control.LoadRecursive() +116
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2910
小智 5
我正在阅读有关此内容的内容,并且在 32 位和 64 位之间进行连接时存在问题。您的应用程序是为 x86 编译的吗?假设您使用的是 32 位 ODBC 数据源。
从我在其他有同样问题的人身上看到的(我从未遇到过这种情况),您可以通过将您的应用程序移动到 32 位(如果数据源是 32 位)或其他人也卸载了 64 位版本的 filemaker 和安装了32位。
这很可能是问题所在,但由于我不了解您的环境,因此我无法真正为您提供适当的解决方案。
| 归档时间: |
|
| 查看次数: |
2304 次 |
| 最近记录: |