I've an ODBC connection to reach an Oracle database, the connection does Open(). I get an overflow error when i try to access to data in the DB.
private void button4_Click(object sender, EventArgs e)
{
string MySelectString = "SELECT * FROM QE_AGENT.IMP_BANK WHERE BANK_LOT = '13120314' AND BANK_COMPTE = '1021'";
string MyConnString = "info de connexion";
OdbcConnection MyConnec = new OdbcConnection(MyConnString);
MyConnec.Open();
OdbcDataAdapter adapter = new OdbcDataAdapter(MySelectString, MyConnec);
DataSet MyDataSet = new DataSet();
adapter.Fill(MyDataSet); <---- i get the error here
}
1) As i searched i found out this might be a drvier problem, when i try to connect my DB through graphical interface i can only see my x86 ODBC sources. But if i do the connection inside the code it works fine with the x64 source.
2) I've tried with Datareader now i try with DataAdapter+DataSet but i get the same error with both.
3) this SQL query should select only 1 row in my DB, can the problem of overflow be because the connection failed and it return null ?
Any suggestion ? Thanks
EDIT: Here is the exception's details
L'exception System.OverflowException s'est produite
HResult=0x80131516 Message=L'opération arithmétique a provoqué un dépassement de capacité. Source=System.Data Arborescence des appels de procédure :at System.Data.Odbc.OdbcDataReader.FirstResult()
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
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(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at Test.Form1.button4_Click(Object sender, EventArgs e) in
C:\Users\sysnt2\documents\visual studio 2017\Projects\Test\Test\Form1.cs:line 75
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNa>tiveMethods.IMsoComponentManager.FPushMessageLoop
(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context) at Test.Program.Main() in C:\Users\sysnt2\documents\visual studio
2017\Projects\Test\Test\Program.cs:line 19
The possible reason for your error could be that, One or more columns in your table QE_AGENT.IMP_BANK could have an Oracle data with a datatype that is not accommodating in the .Net Dataset.
I just find out why it didnt work, the person who installed my ODBC driver installed the x86 and named it x64. I had to reinstall everything and now it works perfectly.
Thank you tho :)
User contributions licensed under CC BY-SA 3.0