我在AS400上运行ODBC数据库。我创建了一个连接字符串来连接数据库并运行查询。当我将程序编译为32位时,我的所有查询都运行正常,但当我将它们编译为64位时,我得到一个溢出异常。不幸的是,我必须将我的程序编译为64位。
可能导致此问题的原因以及我该如何解决?
更多信息:
我正在使用的驱动程序是iSeries Access ODBC Driver
我的所有数据库列都是字符串或小数
我使用的是连接字符串而不是DNS
我正在使用的连接字符串是
“Driver = {iSeries Access ODBC Driver}; uid = XXX; data provider = ODBC; system = 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 :(得分:0)
我发现使用OLE驱动程序而不是ODBC可以防止出现此问题。仍不确定问题是什么。