Problem using OracleLoader

Problem using OracleLoader

Postby martyphee » Fri 19 Sep 2008 15:27

Unable to cast object of type 'CoreLab.Oracle.OracleNumber' to type 'System.IConvertible'.

at System.Convert.ToInt32(Object value)
at CoreLab.Oracle.OracleLoader.a(Int32 A_0, OracleNumber A_1, OracleLoaderColumnCollection A_2)
at CoreLab.Oracle.OracleLoader.SetNumber(Int32 i, OracleNumber value)
at CoreLab.Oracle.OracleLoader.SetNumber(String name, OracleNumber value)
at MDInterfaces.Interfaces.DTNInterface.GetAllTicks() in C:\Documents and Settings\pheemj\My Documents\Visual Studio 2008\Projects\MarketData\MDInterfaces\Interfaces\DTNInterface.cs:line 131
at Program.GetAllTicks() in C:\Documents and Settings\pheemj\My Documents\Visual Studio 2008\Projects\MarketData\GetMarketData\Program.cs:line 54
at Program.Main(String[] args) in C:\Documents and Settings\pheemj\My Documents\Visual Studio 2008\Projects\MarketData\GetMarketData\Program.cs:line 20
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Table Layout
create table TICK_DATA_HEADER_NEW
(
TH_ID NUMBER not null,
TH_SESSION DATE not null,
TH_TICKERSYMBOL VARCHAR2(15) not null,
TH_TIMEZONE NUMBER(4) not null,
TH_TICK_CNT NUMBER(7) not null,
TH_FRACTION NUMBER(1) not null
)

Code:
header = new OracleLoader();
header.Connection = conn;
header.TableName = "tick_data_header_new";
header.CreateColumns();
header.Open();
.
.
.
header.SetNumber("TH_TIMEZONE", h.TimeZone);
header.SetNumber("TH_FRACTION", h.Fraction);

I've tried different variations of calling SetNumber without success. If I change the precision of the columns to say number(5,1) then it works.

OracleDirect 4.75.42.0
Oracle 9i
martyphee
 
Posts: 8
Joined: Fri 27 Jun 2008 19:13

Postby martyphee » Fri 19 Sep 2008 15:53

SetInt works with columns without precision, but I don't know if that will cause other problems.
martyphee
 
Posts: 8
Joined: Fri 27 Jun 2008 19:13

Postby Paul » Fri 19 Sep 2008 15:55

Thank you for your sample. We reproduced this problem and fixed it. This fix will be included in the
next OraDirect .NET build.
Try to use header.SetInt function as workaround
Paul
 
Posts: 725
Joined: Thu 28 Oct 2004 14:06


Return to dotConnect for Oracle