public static List <ADQ_COMUN> GenerarOracleCommandCursor_Combo(string SP, string[] Parametros, object[] Valores) { Conexion objConexion = new Conexion(); OracleConnection cn = objConexion.getConexion(); cn.Open(); OracleCommand cmd = cn.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = SP; OracleParameter par1 = new OracleParameter(); if (Parametros != null) { for (int i = 0; i <= Parametros.Length - 1; i++) { cmd.Parameters.Add(Parametros[i], OracleDbType.Varchar2).Value = Valores[i]; } } par1.OracleDbType = OracleDbType.RefCursor; par1.Direction = System.Data.ParameterDirection.Output; cmd.Parameters.Add(par1); cmd.ExecuteNonQuery(); OracleRefCursor cursor = (OracleRefCursor)par1.Value; OracleDataReader dr = cursor.GetDataReader(); List <ADQ_COMUN> listarCombo = new List <ADQ_COMUN>(); while (dr.Read()) { ADQ_COMUN objCombo = new ADQ_COMUN(); objCombo.ID = Convert.ToString(dr[0]); objCombo.DESCRIPCION = Convert.ToString(dr[1]); listarCombo.Add(objCombo); } cn.Close(); par1.Dispose(); cmd.Dispose(); cn.Dispose(); objConexion = null; return(listarCombo); }
public static List <ADQ_COMUN> GenerarOracleCommandCursor_Combo(string SP) { Conexion objConexion = new Conexion(); OracleConnection cn = objConexion.getConexion("CONEXION_INGRESOS"); cn.Open(); OracleCommand cmd = cn.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = SP; OracleParameter par1 = new OracleParameter(); par1.OracleDbType = OracleDbType.RefCursor; par1.Direction = System.Data.ParameterDirection.Output; cmd.Parameters.Add(par1); cmd.ExecuteNonQuery(); OracleRefCursor cursor = (OracleRefCursor)par1.Value; OracleDataReader dr = cursor.GetDataReader(); List <ADQ_COMUN> listarCombo = new List <ADQ_COMUN>(); while (dr.Read()) { ADQ_COMUN objCombo = new ADQ_COMUN(); objCombo.ID_GRUPO = Convert.ToString(dr["Id"]); objCombo.DESCRIPCION = Convert.ToString(dr["Descripcion"]); listarCombo.Add(objCombo); } cn.Close(); par1.Dispose(); cmd.Dispose(); cn.Dispose(); objConexion = null; return(listarCombo); }