I hope you can help me with my problem which is as follows:
I have an application made in C#
that connects to a database of Oracle
, and in turn in this I have a table with a field INTERVAL DAY(2) TO SECOND(6)" (TIEMPOEJECUCION)
when I bring all the fields in the table read all correctly except this field Interval I tried everything until I made a cast and nothing works for me, I hope you can help me.
PS: The most curious thing is that in SQL Developer
if I see the information of Type Interval
Greetings!
public static Documento SelectByNUNICODOCT(long NUNICODOCT)
{
var resultado = (Documento)null;
using (var conexion = new OracleConnection(ConfigurationManager.ConnectionStrings["CadenaConexion"].ConnectionString))
using (var comando = conexion.CreateCommand())
{
comando.CommandText = "SELECT NUNICODOCT , TIPODOCUMENTO , IDEQUIPO , NOHOJAS , NOHOJASPROC , TIEMPOEJECUCION, FECHADESCARGA , FECHAPROCESO , FECHAREGRESO , PESO FROM APP_OCR.DOCUMENTO WHERE NUNICODOCT=:NUNICODOCT";
comando.Parameters.Add(new OracleParameter("NUNICODOCT", NUNICODOCT));
using (var lector = comando.ExecuteReader())
if (lector.Read())
resultado = Mapping(lector);
if (conexion.State != ConnectionState.Closed)
conexion.Close();
}
return resultado;
}
private static Documento Mapping(OracleDataReader lector)
{
var resultado = new Documento();
resultado.NUNICODOCT = lector.GetInt64(0);
resultado.TipoDocumento = lector.GetInt16(1);
if (!lector.IsDBNull(2))
resultado.IdEquipo = lector.GetInt64(2);
if (!lector.IsDBNull(3))
resultado.NoHojas = lector.GetInt32(3);
if (!lector.IsDBNull(4))
resultado.NoHojasProc = lector.GetInt32(4);
if (!lector.IsDBNull(5)) // Esta línea siempre lleva el valor Nulo
resultado.TiempoEjecucion = lector.GetTimeSpan(5);
if (!lector.IsDBNull(6))
resultado.FechaDescarga = lector.GetDateTime(6);
if (!lector.IsDBNull(7))
resultado.FechaProceso = lector.GetDateTime(7);
if (!lector.IsDBNull(8))
resultado.FechaRegreso = lector.GetDateTime(8);
if (!lector.IsDBNull(9))
resultado.Peso = lector.GetInt64(9);
return resultado;
}