public string Get_nombrecompleto(int rut) { try { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("Get_nombre_usuarioby_Rut", con); cm.BindByName = true; cm.CommandType = System.Data.CommandType.StoredProcedure; cm.Parameters.Add("p_rut", OracleDbType.Int32).Value = rut; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.Varchar2, 40); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); cm.ExecuteNonQuery(); con.Close(); return(output.Value.ToString()); } } catch (Exception ex) { Console.WriteLine("" + ex); return(""); } }
public DataTable getIngredientesFromPlato(int id_plat) { using (OracleConnection con = new conexion().Conexion()) { OracleCommand cm = new OracleCommand("GetIngredientesFromPlato", con); cm.BindByName = true; cm.CommandType = CommandType.StoredProcedure; cm.Parameters.Add("id_plat", OracleDbType.Varchar2).Value = id_plat; OracleParameter output = cm.Parameters.Add("my_cursor", OracleDbType.RefCursor); output.Direction = System.Data.ParameterDirection.ReturnValue; con.Open(); cm.ExecuteNonQuery(); OracleDataReader reader = ((OracleRefCursor)output.Value).GetDataReader(); con.Close(); using (DataTable dt = new DataTable()) { OracleDataAdapter adapter = new OracleDataAdapter(cm); adapter.Fill(dt); return(dt); } } }