2014-01-09 56 views
0

我有一個在AS400上運行的ODBC數據庫。我創建了一個連接字符串連接到數據庫並運行查詢。當我將程序編譯爲32位時,所有的查詢都運行良好,但是當我將它們編譯爲64位時,我得到一個溢出異常。不幸的是,我必須將我的程序編譯爲64位。僅在64位應用程序中從SQL溢出異常

什麼可能導致這個問題,我該如何解決它?

更多信息:
我使用的驅動程序的iSeries訪問ODBC驅動程序
我所有的數據庫列是字符串或小數
我使用一個連接字符串不是DNS
連接字符串我使用m爲
「驅動程序= {i系列Access ODBC驅動}; UID = XXX;數據提供者= ODBC;系統= XXX; DBQ = XXX; PWD = XXX」

我明白任何幫助。

的代碼看起來是這樣的:

MPDCHFTableAdapter configs = new MPDCHFTableAdapter(); 
variants = configs.GetDataByProduct("98.M1BODY"); 

堆棧跟蹤爲:

System.OverflowException was unhandled 
    HResult=-2146233066 
    Message=Arithmetic operation resulted in an overflow. 
    Source=System.Data 
    StackTrace: 
     at System.Data.Odbc.OdbcDataReader.GetSqlType(Int32 i) 
     at System.Data.Odbc.OdbcDataReader.GetFieldType(Int32 i) 
     at System.Data.ProviderBase.SchemaMapping.SetupSchemaWithoutKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, Boolean gettingData, DataColumn parentChapterColumn, Object chapterValue) 
     at System.Data.ProviderBase.SchemaMapping..ctor(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, Boolean keyInfo, SchemaType schemaType, String sourceTableName, Boolean gettingData, DataColumn parentChapterColumn, Object parentChapterValue) 
     at System.Data.Common.DataAdapter.FillMappingInternal(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue) 
     at System.Data.Common.DataAdapter.FillMapping(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue) 
     at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) 
     at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) 
     at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) 
     at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) 
     at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) 
     at M3DataSorting.M3DataTableAdapters.MPDCHFTableAdapter.GetDataByProduct(String QIPRNO) in u:\Visual Studio 2012\Projects\M3DataSorting\M3DataSorting\M3Data.Designer.cs:line 8280 
     at M3DataSorting.Program.update98SLURRY() in u:\Visual Studio 2012\Projects\M3DataSorting\M3DataSorting\Program.cs:line 314 
     at M3DataSorting.Program.Main(String[] args) in u:\Visual Studio 2012\Projects\M3DataSorting\M3DataSorting\Program.cs:line 61 
     at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: 
+0

如何向我們展示查詢和完整的錯誤消息。 – OldProgrammer

+0

你能否發佈異常文本和完整的堆棧跟蹤。 –

+1

是的,一定會得到驅動程序的確切版本。它只能與32位的驅動程序兼容。您可能需要從驅動程序的生產者獲取64位版本。 –

回答

0

心中已經發現,使用OLE驅動程序而不是ODBC防止這個問題的發生。仍然不確定問題是什麼。

相關問題