10 Replies Latest reply: Jun 10, 2013 10:53 AM by gdarling - oracle RSS

    Oracle Date Field Exception

    640318
      When using the ODP.NET provider version 2.111.6.20 to access an Oracle 9i database we get errors with some date fields. We can read most records fine, however, on some records we get an exception "Year, Month, and Day parameters describe an un-representable DateTime"

      We get this error the second we try to access the field. It doesn't matter how we access it we still get the error.

      We are using an OracleDataReader object and have tried the following.

      object o = reader["FieldName"];

      object o = reader.GetValue(i);

      string s = reader.GetValue(i).ToString();

      string s = reader["FieldName"].ToString();

      Oracle.DataAccess.Types.OracleDate d = (Oracle.DataAccess.Types.OracleDate)reader;

      Oracle.DataAccess.Types.OracleDate d = reader.GetOracleDate(i); * This returns a different error. It says "ORA-1866: the datetime class is invalid"

      DateTime d = reader.GetDateTime(i);

      I'm pretty well stumped at this point. I can't get this record & field to do anything but throw an exception whenever accessed in .Net.

      However, if I query the table in Oracle SQL Developer it shows the value 31-DEC-01 for the field.

      Thanks for any assistance.