asp.net调用
oracle存储过程返回数据集
----------------这个是定义的包
CREATE OR REPLACE PACKAGE AllUserWorkType IS
TYPE MYCURSOR IS REF CURSOR;
PROCEDURE P_GetAllUserWorkType_two(CUR_OUT OUT MYCURSOR);
END;
CREATE OR REPLACE PACKAGE BODY AllUserWorkType IS
PROCEDURE P_GetAllUserWorkType(CUR_OUT OUT MYCURSOR) AS
BEGIN
OPEN CUR_OUT FOR
select REAL_NAME,service_name,count(*) counts from T_CSD_JOB inner join T_CSD_SERVICE_TYPE
on T_CSD_JOB.t_Csd_Service_Type_Id=T_CSD_SERVICE_TYPE.t_Csd_Service_Type_Id
inner join T_CSD_JOB_USEDTIME on T_CSD_JOB_USEDTIME.t_Csd_Job_Service_Id=T_CSD_JOB.T_CSD_JOB_ID
inner join T_CSD_C_USER_INFO on T_CSD_C_USER_INFO.t_Csd_c_User_Info_Id=T_CSD_JOB_USEDTIME.Eng_Code
group by service_name,REAL_NAME;
END P_GetAllUserWorkType;
——————————————————————————————
在asp.net里面怎么调用这个存储过程返回的数据集,显示在界面上
------解决方案--------------------
C# code
--晕,选错语言了
protected void DoBind()
{
OracleConnection conn = new OracleConnection("....");
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
cmd.CommandText = "AllUserWorkType.P_GetAllUserWorkType";
cmd.Parameters.Add("MYCURSOR", OracleType.Cursor).Direction=ParameterDirection.Output;
OracleDataReader dr = cmd.ExecuteReader();
this.GridView1.DataSource = dr;
this.GridView1.DataBind();
}