I am writing here the C# and SP which I am using. C# Code:
Public DataTable ExecuteReport(ReportFilters filterAttribute) { DataTable dtDetailedReport = new DataTable(); using (OracleConnection conn = new OracleConnection()) { conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; OracleCommand cmd = new OracleCommand(); cmd.Connection =conn; cmd.CommandText = "count_emp_by_dept"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("pin_no", OracleType.VarChar, 200).Value = filterAttribute.PIN; cmd.Parameters.Add("pResult ", OracleType.Cursor).Direction = ParameterDirection.Output; OracleDataAdapter adap =new OracleDataAdapter(cmd); adap.Fill(dtDetailedReport); conn.Close(); } return dtDetailedReport; }
Ceate or replace procedure count_emp_by_dept(pin_no Varchar2, pResult out sys_refcursor) is begin open pResult for select pinname from TOC2_Test where pin = pin_no; end count_emp_by_dept;
Quote:Make sure you set the SIZE property on the parameter before executing. With output parameters in Oracle, the specified size acts as a buffer. If the buffer isn't set, it is 0 so you don't get the value from the database. C# var param = Ocmd.Parameters.AddWithValue("OUTPUTParam","").Direction = ParameterDirection.Output; param.Size = 255;
var param = Ocmd.Parameters.AddWithValue("OUTPUTParam","").Direction = ParameterDirection.Output; param.Size = 255;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)