110,555
社区成员
发帖
与我相关
我的任务
分享
CREATE OR REPLACE PROCEDURE P_GETALLDOC( CFLOWSN IN NUMBER, v_rt out sys_refcursor)
AS
BEGIN
open v_rt for
select Flowsn,Attachid as id,attachfile as name from ATTACH where flowsn=CFLOWSN
union all
select flowsn,eformid as id,formname as name from flowforms where flowsn=CFLOWSN;
END P_GETALLDOC;
OracleParameter[] paras = new OracleParameter[2];
paras[0] = new OracleParameter("CFLOWSN", OracleType.Number,12);
paras[0].Value = Convert.ToInt32(flowsn);
paras[0].Direction = ParameterDirection.Input;
paras[1] = new OracleParameter("v_rt", OracleType.Cursor);
paras[1].Direction = ParameterDirection.Output;
string connString = ConfigurationManager.AppSettings["ConnString"];
var conn = new OracleConnection(connString);
conn.Open();
OracleCommand oraCmd = new OracleCommand("P_GETALLDOC", conn);
oraCmd.CommandType = CommandType.StoredProcedure;
oraCmd.Parameters.Clear();//先清空
foreach (OracleParameter parme in paras)
{
oraCmd.Parameters.Add(parme);
}
DataTable table = new DataTable();
OracleDataAdapter da1 = new OracleDataAdapter(oraCmd);//取出数据
da1.Fill(table);
//没有记录,实际是有的
if (table.Rows.Count > 0)
{
context.Response.Write("记录:" + table.Rows.Count);
}