Select of DateTimes BC throws exception

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
sebniepel
Posts: 9
Joined: Tue 08 Sep 2009 09:42

Select of DateTimes BC throws exception

Post by sebniepel » Tue 08 Sep 2009 10:30

The exception text is:
Year, Month, and Day parameters describe an unrepresentable DateTime

The Database I used was Oracle 10g Express

I can reproduce it with any date field. For example in the HR scheme:
"update EMP set HIRE_DATE = TO_DATE('-2/01/01', 'syyyy/mm/dd') where EMPLOYEE_ID = 100;"

A select "select To_char(EMP.HIRE_DATE,'syyyy/mm/dd') from EMP where EMPLOYEE_ID = 100;" shows the right result
-0002/01/01

When executing "select * from emp where employee_ID = 100" with the DataReader, I get (in german):
Devart.Data.Oracle.OracleException: Die Parameter "Year", "Month", und "Day" beschreiben eine nicht darstellbare DateTime.
bei Devart.Data.Oracle.OracleDate.b(Byte[] A_0, Int32 A_1)
bei Devart.Data.Oracle.ag.b(Byte[] A_0, Int32 A_1, Int32 A_2)
bei Devart.Data.Oracle.OracleDataReader.GetValue(Int32 i)

When I change back the date to a positive value (e.g. 0002/01/01) it works fine.

My Devart Version is 5.25.37.

Thanks in Advance,
Seb

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 09 Sep 2009 07:39

The System.DateTime value type represents dates and times with values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.). System.DateTime cannot contain negative values.
Please refer to http://msdn.microsoft.com/en-us/library ... etime.aspx .

Please call Devart.Data.Oracle.OracleDataReader.GetOracleValue(Int32 i) instead of Devart.Data.Oracle.OracleDataReader.GetValue(Int32 i).

Post Reply