方正快速开发平台中C#调用oracle返回参数,结果集
存储过程
CREATE OR REPLACE PROCEDURE p_test(v_userid VARCHAR2,
v_fullname out Varchar2,
p_cursor out ego.cursorType)
as
begin
select fullname into v_fullname from sys_user where userid = v_userid;
open p_cursor for
select * from sys_user;
end;
其中,要返回结果集,需返回平台自定义的cursor ego.cursorType
表单代码
using System.Data;
using CX.DBA;
using CX.Core;
public void onAfterPageLoad()
{
string sqlstr = "p_test";//存储过程名
string userid = "system";//入参
string fullname = ""; //接返回参数用
Parm_Struct puserid = new Parm_Struct("v_userid", userid);
Parm_Struct pfullname = new Parm_Struct("v_fullname", "");//此处给任意值都可以
pfullname.ParmDirect = ParameterDirection.Output;//表示是出参
DataTable dt = this.dbgr.GetDataTable(sqlstr,CommandType.StoredProcedure,new Parm_Struct[] { puserid,pfullname});
fullname = this.dbgr.GetCmdParmValue("fullname").ToString();
ExKernel.CommFunc.RegisterClientScriptBlock("alert('"+fullname+"')");//弹出测试用
}
CREATE OR REPLACE PROCEDURE p_test(v_userid VARCHAR2,
v_fullname out Varchar2,
p_cursor out ego.cursorType)
as
begin
select fullname into v_fullname from sys_user where userid = v_userid;
open p_cursor for
select * from sys_user;
end;
其中,要返回结果集,需返回平台自定义的cursor ego.cursorType
表单代码
using System.Data;
using CX.DBA;
using CX.Core;
public void onAfterPageLoad()
{
string sqlstr = "p_test";//存储过程名
string userid = "system";//入参
string fullname = ""; //接返回参数用
Parm_Struct puserid = new Parm_Struct("v_userid", userid);
Parm_Struct pfullname = new Parm_Struct("v_fullname", "");//此处给任意值都可以
pfullname.ParmDirect = ParameterDirection.Output;//表示是出参
DataTable dt = this.dbgr.GetDataTable(sqlstr,CommandType.StoredProcedure,new Parm_Struct[] { puserid,pfullname});
fullname = this.dbgr.GetCmdParmValue("fullname").ToString();
ExKernel.CommFunc.RegisterClientScriptBlock("alert('"+fullname+"')");//弹出测试用
}
浙公网安备 33010602011771号